Résolu Crash CommonProxy 1.12.2
-
En suivant ce tuto, tout allait bien jusqu’au moment où il faut lancer le jeu. À ce moment là, le jeu crash. Voici le report.
Time: 3/16/19 11:40 PM
Description: There was a severe problem during mod loading that has caused the game to failnet.minecraftforge.fml.common.LoaderExceptionModCrash: Caught exception from Genetical Progresses (geneticalprogresses)
Caused by: java.lang.IllegalArgumentException: Can not set static com.g2bk.geneticalprogresses.CommonProxy field com.g2bk.geneticalprogresses.ModGeneticalProgresses.proxy to com.g2bk.geneticalprogresses.ModGeneticalProgresses
at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(Unknown Source)
at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(Unknown Source)
at sun.reflect.UnsafeStaticObjectFieldAccessorImpl.set(Unknown Source)
at java.lang.reflect.Field.set(Unknown Source)
at net.minecraftforge.fml.common.FMLModContainer.parseSimpleFieldAnnotation(FMLModContainer.java:502)
at net.minecraftforge.fml.common.FMLModContainer.processFieldAnnotations(FMLModContainer.java:432)
at net.minecraftforge.fml.common.FMLModContainer.constructMod(FMLModContainer.java:606)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.common.eventbus.Subscriber.invokeSubscriberMethod(Subscriber.java:91)
at com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:150)
at com.google.common.eventbus.Subscriber$1.run(Subscriber.java:76)
at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:399)
at com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:71)
at com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:116)
at com.google.common.eventbus.EventBus.post(EventBus.java:217)
at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:218)
at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:196)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.common.eventbus.Subscriber.invokeSubscriberMethod(Subscriber.java:91)
at com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:150)
at com.google.common.eventbus.Subscriber$1.run(Subscriber.java:76)
at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:399)
at com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:71)
at com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:116)
at com.google.common.eventbus.EventBus.post(EventBus.java:217)
at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:135)
at net.minecraftforge.fml.common.Loader.loadMods(Loader.java:593)
at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:232)
at net.minecraft.client.Minecraft.init(Minecraft.java:513)
at net.minecraft.client.Minecraft.run(Minecraft.java:421)
at net.minecraft.client.main.Main.main(Main.java:118)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
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(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)
at GradleStart.main(GradleStart.java:25)Ma classe principale :
import org.apache.logging.log4j.Logger; 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.SidedProxy; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; @Mod(modid= "geneticalprogresses", name = "Genetical Progresses", version = "1.0", acceptedMinecraftVersions = "[1.12.2]") public class ModGeneticalProgresses { public static final String MODID = "geneticalprogresses"; @Instance(ModGeneticalProgresses.MODID) @SidedProxy(clientSide = "com.g2bk.geneticalprogresses.ClientProxy", serverSide = "com.g2bk.geneticalprogresses.ServerProxy") public static CommonProxy proxy; public static ModGeneticalProgresses instance; public static Logger logger; @EventHandler public void preInit(FMLPreInitializationEvent event) { proxy.preInit(event.getSuggestedConfigurationFile()); logger = event.getModLog(); } @EventHandler public void init(FMLInitializationEvent event) { } }
CommonProxy :
package com.g2bk.geneticalprogresses; import java.io.File; public class CommonProxy { public void preInit(File configFile) { System.out.println("pre init côté commun"); } public void init() { } }
ClientProxy :
package com.g2bk.geneticalprogresses; import java.io.File; public final class ClientProxy extends CommonProxy { @Override public void preInit(File configFile) { super.preInit(configFile); System.out.println("pre init côté client"); } @Override public void init() { super.init(); } }
Et ServerProxy est pareil, juste en replaçant le message affiché (client qu’on remplace par serveur)
-
Bonjour,
Le spoiler pour le log pourquoi pas, par contre pour le code non. Il y a balise code (```) qui est bien plus approprié (ajoute les numéros de ligne + mise en valeur de la syntaxe).
L’annotation
@Instance
doit être au-dessus de la déclaration de l’instance et non au-dessus du proxy. -
Bonjour,
Le spoiler pour le log pourquoi pas, par contre pour le code non. Il y a balise code (```) qui est bien plus approprié (ajoute les numéros de ligne + mise en valeur de la syntaxe).
L’annotation
@Instance
doit être au-dessus de la déclaration de l’instance et non au-dessus du proxy.