MFF

    Minecraft Forge France
    • Récent
    • Mots-clés
    • Populaire
    • Utilisateurs
    • Groupes
    • Forge Events
      • Automatique
      • Foncé
      • Clair
    • S'inscrire
    • Se connecter

    Erreur "n must be positive" lors de la création d'un menu

    Planifier Épinglé Verrouillé Déplacé Résolu 1.7.x
    1.7.2
    8 Messages 3 Publieurs 1.8k Vues 1 Watching
    Charger plus de messages
    • Du plus ancien au plus récent
    • Du plus récent au plus ancien
    • Les plus votés
    Répondre
    • Répondre à l'aide d'un nouveau sujet
    Se connecter pour répondre
    Ce sujet a été supprimé. Seuls les utilisateurs avec les droits d'administration peuvent le voir.
    • I Hors-ligne
      ItsMeKam59
      dernière édition par robin4002

      Bonjour,
      J’ai une erreur lorsque je créé mon menu et que je lance le client.
      J’ai ça :

      [10:11:00] [Client thread/INFO] [FML]: Forge Mod Loader has successfully loaded 4 mods
      [10:11:01] [Client thread/FATAL]: Unreported exception thrown!
      java.lang.IllegalArgumentException: n must be positive
      at java.util.Random.nextInt(Unknown Source) ~[?:1.7.0_55]
      at fr.ewearys.mod.GuiCustomMainMenu.<init>(GuiCustomMainMenu.java:89) ~[GuiCustomMainMenu.class:?]
      at fr.ewearys.mod.ModCustomMenu.onTickClient(ModCustomMenu.java:43) ~[ModCustomMenu.class:?]
      at cpw.mods.fml.common.eventhandler.ASMEventHandler_4_ModCustomMenu_onTickClient_ClientTickEvent.invoke(.dynamic) ~[?:?]
      at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:51) ~[ASMEventHandler.class:?]
      at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:122) ~[EventBus.class:?]
      at cpw.mods.fml.common.FMLCommonHandler.onPostClientTick(FMLCommonHandler.java:310) ~[FMLCommonHandler.class:?]
      at net.minecraft.client.Minecraft.runTick(Minecraft.java:2161) ~[Minecraft.class:?]
      at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1035) ~[Minecraft.class:?]
      at net.minecraft.client.Minecraft.run(Minecraft.java:951) [Minecraft.class:?]
      at net.minecraft.client.main.Main.main(Main.java:112) [Main.class:?]
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_55]
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_55]
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_55]
      at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_55]
      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:?]
      –-- Minecraft Crash Report ----
      // Uh... Did I do that?
      
      Time: 29/06/14 10:11
      Description: Unexpected error
      
      java.lang.IllegalArgumentException: n must be positive
      at java.util.Random.nextInt(Unknown Source)
      at fr.ewearys.mod.GuiCustomMainMenu.<init>(GuiCustomMainMenu.java:89)
      at fr.ewearys.mod.ModCustomMenu.onTickClient(ModCustomMenu.java:43)
      at cpw.mods.fml.common.eventhandler.ASMEventHandler_4_ModCustomMenu_onTickClient_ClientTickEvent.invoke(.dynamic)
      at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:51)
      at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:122)
      at cpw.mods.fml.common.FMLCommonHandler.onPostClientTick(FMLCommonHandler.java:310)
      at net.minecraft.client.Minecraft.runTick(Minecraft.java:2161)
      at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1035)
      at net.minecraft.client.Minecraft.run(Minecraft.java:951)
      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:
      ---------------------------------------------------------------------------------------
      
      -- System Details --
      Details:
      Minecraft Version: 1.7.2
      Operating System: Windows 7 (x86) version 6.1
      Java Version: 1.7.0_55, Oracle Corporation
      Java VM Version: Java HotSpot(TM) Client VM (mixed mode), Oracle Corporation
      Memory: 932562056 bytes (889 MB) / 1060372480 bytes (1011 MB) up to 1060372480 bytes (1011 MB)
      JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
      AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
      IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
      FML: MCP v9.01-pre FML v7.2.116.1024 Minecraft Forge 10.12.0.1024 4 mods loaded, 4 mods active
      mcp{8.09} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available
      FML{7.2.116.1024} [Forge Mod Loader] (forgeSrc-1.7.2-10.12.0.1024.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available
      Forge{10.12.0.1024} [Minecraft Forge] (forgeSrc-1.7.2-10.12.0.1024.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available
      Ewearys{1.0} [Ewearys] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available
      Launched Version: 1.6
      LWJGL: 2.9.0
      OpenGL: GeForce 210/PCIe/SSE2 GL version 3.3.0, NVIDIA Corporation
      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)
      Vec3 Pool Size: ~~ERROR~~ NullPointerException: null
      Anisotropic Filtering: Off (1)
      #@!@# Game crashed! Crash report saved to: #@!@# C:\Users\Kamil\Desktop\Overworld\Modding\launcher 1.7\Launcher crack\forge 1.7.2 (1024)\eclipse\.\crash-reports\crash-2014-06-29_10.11.01-client.txt
      AL lib: (EE) alc_cleanup: 1 device not closed
      

      Seriez-vous m’aider et me dire quelle est l’erreur ?

      Cordialement,

      PS : Si vous voulez les codes, je vous les fournis.</init></init>

      1 réponse Dernière réponse Répondre Citer 0
      • ÜberfapÜ Hors-ligne
        Überfap
        dernière édition par

        Les codes s’il te plaît 😄 Apparemment, il y a une valeur négative donnée par un random à la ligne 89 du GuiCustomMainMenu alors qu’elle devrait être positive 😉

        Si je t'ai aidé, n'hésites pas à mettre un point de réputation positif !
        Si tu m'as aidé, je n'hésiterais pas à t'en donner à mon tour !

        1 réponse Dernière réponse Répondre Citer 0
        • I Hors-ligne
          ItsMeKam59
          dernière édition par

          Salut, merci de ta réponse.
          C’est ça mon code de ligne 89

          
          public GuiCustomMainMenu()
          {
          BufferedReader bufferedreader = null;
          try
          {
          ArrayList arraylist = new ArrayList();
          bufferedreader = new BufferedReader(new InputStreamReader(Minecraft.getMinecraft().getResourceManager().getResource(splashTexts).getInputStream(), Charsets.UTF_8));
          String s;
          while ((s = bufferedreader.readLine()) != null)
          {
          
          }
          do
          {
          this.splashText = ((String)arraylist.get(rand.nextInt(arraylist.size())));
          } while (this.splashText.hashCode() == 125780783);
          }
          
          

          Cordialement,

          1 réponse Dernière réponse Répondre Citer 0
          • jglrxavpokJ Hors-ligne
            jglrxavpok Modérateurs
            dernière édition par

            Il faut ajouter ta variable s à l’ArrayList, sinon la taille de cette liste est de 0 donc une valeur non positive (en maths anglais)

            Modérateur sur MFF. 
            Mon Github: http://github.com/jglrxavpok
            Mon compte Steam si vous voulez jouer à CS:GO ou TF2 avec moi: https://steamcommunity.com/id/jglrxavpok/

            1 réponse Dernière réponse Répondre Citer 0
            • I Hors-ligne
              ItsMeKam59
              dernière édition par

              Si je mets ça :

              
              {
              String s = s.trim();
              if (!s.isEmpty()) {
              arraylist.add(s);
              }
              }
              
              

              Je dois renommer

              
              string s
              
              

              en s1
              Cela renomme tout en s1
              Mais après

              
              s.trim();
              
              

              J’ai cette erreur : “the local variable s1 may not have been initialized.”
              je dois faire quoi?

              Cordialement,

              1 réponse Dernière réponse Répondre Citer 0
              • ÜberfapÜ Hors-ligne
                Überfap
                dernière édition par

                Bah non tu fais String s1 = s.trim() et après tu fait arrayList.add(s1)

                Si je t'ai aidé, n'hésites pas à mettre un point de réputation positif !
                Si tu m'as aidé, je n'hésiterais pas à t'en donner à mon tour !

                1 réponse Dernière réponse Répondre Citer 1
                • I Hors-ligne
                  ItsMeKam59
                  dernière édition par

                  Merci de ton aide 🙂

                  1 réponse Dernière réponse Répondre Citer 0
                  • ÜberfapÜ Hors-ligne
                    Überfap
                    dernière édition par

                    Oh mais de rien 😄 Ravi de t’avoir aidé 😉

                    Si je t'ai aidé, n'hésites pas à mettre un point de réputation positif !
                    Si tu m'as aidé, je n'hésiterais pas à t'en donner à mon tour !

                    1 réponse Dernière réponse Répondre Citer 0
                    • 1 / 1
                    • Premier message
                      Dernier message
                    Design by Woryk
                    ContactMentions Légales

                    MINECRAFT FORGE FRANCE © 2024

                    Powered by NodeBB