Crash a la connection



  • Salut,

    voici mon problème, j'ai cree un mod qui remplace le MainGui par le mien tout fonctionne sauf lorsque l'on appui sur le bouton de connexion auto a mon serveur

    j'utilise ce code pour faire la connexion

    FMLClientHandler.instance().connectToServer(this, new ServerData("nomDuServeur", "ipDuServeur:portDuServeur"));
    

    j'obtient cela dans les log
    :::

    [Client thread/FATAL]: Reported exception thrown!
    net.minecraft.util.ReportedException: Updating screen events
    at net.minecraft.client.Minecraft.runTick(Minecraft.java:1689) ~[Minecraft.class:?]
    at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:984) ~[Minecraft.class:?]
    at net.minecraft.client.Minecraft.run(Minecraft.java:900) [Minecraft.class:?]
    at net.minecraft.client.main.Main.main(Main.java:112) [Main.class:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_79]
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_79]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_79]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_79]
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) [launchwrapper-1.9.jar:?]
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.9.jar:?]
    Caused by: java.lang.NullPointerException
    at cpw.mods.fml.client.FMLClientHandler.connectToServer(FMLClientHandler.java:811) ~[FMLClientHandler.class:?]
    at com.synoria.dudu54330.menu.commom.GuiCustomMainMenu.actionPerformed(GuiCustomMainMenu.java:279) ~[GuiCustomMainMenu.class:?]
    at net.minecraft.client.gui.GuiScreen.mouseClicked(GuiScreen.java:252) ~[GuiScreen.class:?]
    at com.synoria.dudu54330.menu.commom.GuiCustomMainMenu.mouseClicked(GuiCustomMainMenu.java:581) ~[GuiCustomMainMenu.class:?]
    at net.minecraft.client.gui.GuiScreen.handleMouseInput(GuiScreen.java:349) ~[GuiScreen.class:?]
    at net.minecraft.client.gui.GuiScreen.handleInput(GuiScreen.java:313) ~[GuiScreen.class:?]
    at net.minecraft.client.Minecraft.runTick(Minecraft.java:1675) ~[Minecraft.class:?]
    … 9 more
    

    :::

    et ça dans le crash report
    :::

    Description: Updating screen events
    
    java.lang.NullPointerException: Updating screen events
    at cpw.mods.fml.client.FMLClientHandler.connectToServer(FMLClientHandler.java:811)
    at com.synoria.dudu54330.menu.commom.GuiCustomMainMenu.actionPerformed(GuiCustomMainMenu.java:279)
    at net.minecraft.client.gui.GuiScreen.mouseClicked(GuiScreen.java:252)
    at com.synoria.dudu54330.menu.commom.GuiCustomMainMenu.mouseClicked(GuiCustomMainMenu.java:581)
    at net.minecraft.client.gui.GuiScreen.handleMouseInput(GuiScreen.java:349)
    at net.minecraft.client.gui.GuiScreen.handleInput(GuiScreen.java:313)
    at net.minecraft.client.Minecraft.runTick(Minecraft.java:1675)
    at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:984)
    at net.minecraft.client.Minecraft.run(Minecraft.java:900)
    at net.minecraft.client.main.Main.main(Main.java:112)
    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:134)
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
    
    A detailed walkthrough of the error, its code path and all known details is as follows:
    ---------------------------------------------------------------------------------------
    
    -- Head --
    Stacktrace:
    at cpw.mods.fml.client.FMLClientHandler.connectToServer(FMLClientHandler.java:811)
    at com.synoria.dudu54330.menu.commom.GuiCustomMainMenu.actionPerformed(GuiCustomMainMenu.java:279)
    at net.minecraft.client.gui.GuiScreen.mouseClicked(GuiScreen.java:252)
    at com.synoria.dudu54330.menu.commom.GuiCustomMainMenu.mouseClicked(GuiCustomMainMenu.java:581)
    at net.minecraft.client.gui.GuiScreen.handleMouseInput(GuiScreen.java:349)
    at net.minecraft.client.gui.GuiScreen.handleInput(GuiScreen.java:313)
    
    -- Affected screen --
    Details:
    Screen name: com.synoria.dudu54330.menu.commom.GuiCustomMainMenu
    Stacktrace:
    at net.minecraft.client.Minecraft.runTick(Minecraft.java:1675)
    at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:984)
    at net.minecraft.client.Minecraft.run(Minecraft.java:900)
    at net.minecraft.client.main.Main.main(Main.java:112)
    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:134)
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
    

    a la ligne 279 j'ai ça => FMLClientHandler.instance().connectToServer(this, new ServerData("nomDuServeur", "ipDuServeur:portDuServeur"));
    et a la ligne 581 j'ai ceci => super.mouseClicked(par1, par2, par3);

    :::

    j’espère que quelqu'un pourra m'aider, merci d'avance  🙂


  • Administrateurs

    Salut,
    Il me semble qu'il faut ajouter la ligne FMLClientHandler.instance().setupServerList() avant d'utiliser connectToServer. Ou alors il faut utiliser connectToServerAtStartup (ou une fonction qui y ressemble, je ne me souviens pas du nom exacte).
    Et je déplaces dans la bonne section, merci de faire plus attention à l'avenir …



  • @'robin4002':

    Salut,
    Il me semble qu'il faut ajouter la ligne FMLClientHandler.instance().setupServerList() avant d'utiliser connectToServer. Ou alors il faut utiliser connectToServerAtStartup (ou une fonction qui y ressemble, je ne me souviens pas du nom exacte).
    Et je déplaces dans la bonne section, merci de faire plus attention à l'avenir …

    Merci =D

    tout fonctionne nickel en rajoutant ce que tu a proposé


Log in to reply