MFF

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

    Ajout d'un son quand il neige

    Planifier Épinglé Verrouillé Déplacé Résolu Anciennes versions
    1.6.2
    23 Messages 4 Publieurs 6.6k 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.
    • AxaurusA Hors-ligne
      Axaurus
      dernière édition par

      Salut
      Merci de ta réponse rapide, mais ça ne marche pas.
      J’ai mis le code que tu m’a donné et j’ai remplacer

      modtutoriel:explosion
      

      par

      this_is_christmas:snow
      

      Voila mon customSound :

      package This_is_Christmas;
      
      import net.minecraftforge.client.event.sound.SoundLoadEvent;
      import net.minecraftforge.event.ForgeSubscribe;
      
      public class CustomSound
      {
      @ForgeSubscribe
      public void onSound(SoundLoadEvent event)
      {
      try
      {
      event.manager.soundPoolSounds.addSound("this_is_christmas:abc.ogg");
      event.manager.soundPoolSounds.addSound("this_is_christmas:snow1.ogg");
      event.manager.soundPoolSounds.addSound("this_is_christmas:snow2.ogg");
      event.manager.soundPoolSounds.addSound("this_is_christmas:snow3.ogg");
      event.manager.soundPoolSounds.addSound("this_is_christmas:snow4.ogg");
      }
      catch(Exception e)
      {
      System.out.println("Failed to registry sound");
      }
      }
      }
      

      et le code qui est dans ma classe principale :

      
      TickRegistry.registerTickHandler(new ClientTickHandler(), Side.CLIENT);
      
      

      J’ai mis mes sons dans this_is_christmas/sound

      Voici la console :

      août 24, 2013 4:33:28 PM net.minecraft.launchwrapper.LogWrapper log
      INFO: Using tweak class name cpw.mods.fml.common.launcher.FMLTweaker
      2013-08-24 16:33:28 [INFO] [ForgeModLoader] Forge Mod Loader version 6.2.35.804 for Minecraft 1.6.2 loading
      2013-08-24 16:33:28 [INFO] [ForgeModLoader] Java is Java HotSpot(TM) 64-Bit Server VM, version 1.7.0_25, running on Windows 7:amd64:6.1, installed at C:\Program Files\Java\jre7
      2013-08-24 16:33:28 [INFO] [ForgeModLoader] Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation
      2013-08-24 16:33:28 [INFO] [STDOUT] Loaded 39 rules from AccessTransformer config file fml_at.cfg
      2013-08-24 16:33:28 [INFO] [STDOUT] Loaded 107 rules from AccessTransformer config file forge_at.cfg
      2013-08-24 16:33:30 [SEVERE] [ForgeModLoader] The binary patch set is missing. Either you are in a development environment, or things are not going to work!
      2013-08-24 16:33:31 [INFO] [ForgeModLoader] Launching wrapped minecraft
      2013-08-24 16:33:33 [INFO] [Minecraft-Client] Setting user: Player547
      2013-08-24 16:33:33 [INFO] [Minecraft-Client] (Session ID is null)
      2013-08-24 16:33:35 [INFO] [Minecraft-Client] LWJGL Version: 2.9.0
      2013-08-24 16:33:36 [INFO] [Minecraft-Client] Reloading ResourceManager: Default
      2013-08-24 16:33:37 [INFO] [STDOUT]
      2013-08-24 16:33:37 [INFO] [STDOUT] Starting up SoundSystem…
      2013-08-24 16:33:38 [INFO] [MinecraftForge] Attempting early MinecraftForge initialization
      2013-08-24 16:33:38 [INFO] [STDOUT] MinecraftForge v9.10.0.804 Initialized
      2013-08-24 16:33:38 [INFO] [ForgeModLoader] MinecraftForge v9.10.0.804 Initialized
      2013-08-24 16:33:38 [INFO] [STDOUT] Initializing LWJGL OpenAL
      2013-08-24 16:33:38 [INFO] [STDOUT] (The LWJGL binding of OpenAL. For more information, see http://www.lwjgl.org)
      2013-08-24 16:33:38 [INFO] [STDOUT] Replaced 101 ore recipies
      2013-08-24 16:33:38 [INFO] [MinecraftForge] Completed early MinecraftForge initialization
      2013-08-24 16:33:38 [INFO] [STDOUT] OpenAL initialized.
      2013-08-24 16:33:38 [INFO] [ForgeModLoader] Reading custom logging properties from C:\Users\Antonin\Desktop\Codage\noël\jars\config\logging.properties
      2013-08-24 16:33:38 [OFF] [ForgeModLoader] Logging level for ForgeModLoader logging is set to ALL
      2013-08-24 16:33:38 [INFO] [STDOUT]
      2013-08-24 16:33:38 [INFO] [ForgeModLoader] Searching C:\Users\Antonin\Desktop\Codage\noël\jars\mods for mods
      2013-08-24 16:33:41 [INFO] [ForgeModLoader] Forge Mod Loader has identified 4 mods to load
      2013-08-24 16:33:41 [INFO] [mcp] Activating mod mcp
      2013-08-24 16:33:41 [INFO] [FML] Activating mod FML
      2013-08-24 16:33:41 [INFO] [Forge] Activating mod Forge
      2013-08-24 16:33:41 [INFO] [This_is_Christmas] Activating mod This_is_Christmas
      2013-08-24 16:33:41 [WARNING] [This is Christmas] Mod This is Christmas is missing a pack.mcmeta file, things may not work well
      2013-08-24 16:33:41 [INFO] [Minecraft-Client] Reloading ResourceManager: Default, FMLFileResourcePack:This is Christmas
      2013-08-24 16:33:41 [INFO] [STDOUT]
      2013-08-24 16:33:41 [INFO] [STDOUT] SoundSystem shutting down…
      2013-08-24 16:33:41 [INFO] [STDOUT] Author: Paul Lamb, www.paulscode.com
      2013-08-24 16:33:41 [INFO] [STDOUT]
      2013-08-24 16:33:41 [INFO] [STDOUT]
      2013-08-24 16:33:41 [INFO] [STDOUT] Starting up SoundSystem…
      2013-08-24 16:33:41 [INFO] [ForgeModLoader] Registering Forge Packet Handler
      2013-08-24 16:33:41 [INFO] [ForgeModLoader] Succeeded registering Forge Packet Handler
      2013-08-24 16:33:41 [INFO] [ForgeModLoader] Configured a dormant chunk cache size of 0
      2013-08-24 16:33:41 [INFO] [STDOUT] Initializing LWJGL OpenAL
      2013-08-24 16:33:41 [INFO] [STDOUT] (The LWJGL binding of OpenAL. For more information, see http://www.lwjgl.org)
      2013-08-24 16:33:42 [INFO] [STDOUT] OpenAL initialized.
      2013-08-24 16:33:42 [INFO] [STDOUT]
      2013-08-24 16:33:43 [INFO] [ForgeModLoader] Forge Mod Loader has successfully loaded 4 mods
      2013-08-24 16:33:43 [WARNING] [This is Christmas] Mod This is Christmas is missing a pack.mcmeta file, things may not work well
      2013-08-24 16:33:43 [INFO] [Minecraft-Client] Reloading ResourceManager: Default, FMLFileResourcePack:This is Christmas
      2013-08-24 16:33:44 [INFO] [STDOUT]
      2013-08-24 16:33:44 [INFO] [STDOUT] SoundSystem shutting down…
      2013-08-24 16:33:44 [INFO] [STDOUT] Author: Paul Lamb, www.paulscode.com
      2013-08-24 16:33:44 [INFO] [STDOUT]
      2013-08-24 16:33:44 [INFO] [STDOUT]
      2013-08-24 16:33:44 [INFO] [STDOUT] Starting up SoundSystem…
      2013-08-24 16:33:44 [INFO] [STDOUT] Initializing LWJGL OpenAL
      2013-08-24 16:33:44 [INFO] [STDOUT] (The LWJGL binding of OpenAL. For more information, see http://www.lwjgl.org)
      2013-08-24 16:33:45 [INFO] [STDOUT] OpenAL initialized.
      2013-08-24 16:33:45 [INFO] [STDOUT]
      2013-08-24 16:33:46 [SEVERE] [Minecraft-Client] Realms: Invalid session id
      2013-08-24 16:34:16 [INFO] [Minecraft-Server] Starting integrated minecraft server version 1.6.2
      2013-08-24 16:34:16 [INFO] [Minecraft-Server] Generating keypair
      2013-08-24 16:34:16 [INFO] [ForgeModLoader] Loading dimension 0 (test neige) (net.minecraft.server.integrated.IntegratedServer@36c7401a)
      2013-08-24 16:34:16 [INFO] [ForgeModLoader] Loading dimension 1 (test neige) (net.minecraft.server.integrated.IntegratedServer@36c7401a)
      2013-08-24 16:34:16 [INFO] [ForgeModLoader] Loading dimension -1 (test neige) (net.minecraft.server.integrated.IntegratedServer@36c7401a)
      2013-08-24 16:34:16 [INFO] [Minecraft-Server] Preparing start region for level 0
      2013-08-24 16:34:17 [INFO] [Minecraft-Server] Preparing spawn area: 86%
      2013-08-24 16:34:18 [INFO] [STDOUT] loading single player
      2013-08-24 16:34:18 [INFO] [Minecraft-Server] Player547[/127.0.0.1:0] logged in with entity id 1 at (-992.44003027951, 66.15473176351254, 165.2981697067536)
      2013-08-24 16:34:18 [INFO] [Minecraft-Server] Player547 joined the game
      2013-08-24 16:34:19 [INFO] [STDOUT] Setting up custom skins
      2013-08-24 16:34:21 [INFO] [STDOUT] 0.15
      2013-08-24 16:34:21 [INFO] [STDOUT] 0.25000006
      2013-08-24 16:34:22 [INFO] [STDOUT] 0.32
      2013-08-24 16:34:23 [INFO] [STDOUT] 0.48999983
      2013-08-24 16:34:24 [INFO] [STDOUT] 0.78999954
      2013-08-24 16:34:25 [INFO] [STDOUT] 0.97999936
      2013-08-24 16:34:26 [INFO] [STDOUT] 1.0
      2013-08-24 16:34:26 [INFO] [STDOUT] 1.0
      2013-08-24 16:34:27 [INFO] [STDOUT] 1.0
      2013-08-24 16:34:28 [INFO] [STDOUT] 1.0
      2013-08-24 16:34:28 [INFO] [STDOUT] 1.0
      2013-08-24 16:34:30 [INFO] [STDOUT] 1.0
      2013-08-24 16:34:31 [INFO] [STDOUT] 1.0
      2013-08-24 16:34:32 [INFO] [STDOUT] 1.0
      2013-08-24 16:34:32 [INFO] [STDOUT] 1.0
      2013-08-24 16:34:33 [INFO] [STDOUT] 1.0
      2013-08-24 16:34:34 [INFO] [STDOUT] 1.0
      2013-08-24 16:34:34 [INFO] [STDOUT] 1.0
      2013-08-24 16:34:35 [INFO] [STDOUT] 1.0
      2013-08-24 16:34:35 [INFO] [STDOUT] 1.0
      2013-08-24 16:34:36 [INFO] [STDOUT] 1.0
      2013-08-24 16:34:37 [INFO] [STDOUT] 1.0
      2013-08-24 16:34:37 [INFO] [STDOUT] 1.0
      2013-08-24 16:34:38 [INFO] [STDOUT] 1.0
      2013-08-24 16:34:39 [INFO] [STDOUT] 1.0
      2013-08-24 16:34:39 [INFO] [STDOUT] 1.0
      2013-08-24 16:34:41 [INFO] [STDOUT] 1.0
      2013-08-24 16:34:42 [INFO] [STDOUT] 1.0
      2013-08-24 16:34:42 [INFO] [STDOUT] 1.0
      2013-08-24 16:34:43 [INFO] [STDOUT] 1.0
      2013-08-24 16:34:43 [INFO] [STDOUT] 1.0
      2013-08-24 16:34:44 [INFO] [STDOUT] 1.0
      2013-08-24 16:34:45 [INFO] [STDOUT] 1.0
      2013-08-24 16:34:45 [INFO] [STDOUT] 1.0
      2013-08-24 16:34:46 [INFO] [STDOUT] 1.0
      2013-08-24 16:34:46 [INFO] [STDOUT] 1.0
      2013-08-24 16:34:47 [INFO] [STDOUT] 1.0
      2013-08-24 16:34:47 [INFO] [STDOUT] 1.0
      2013-08-24 16:34:50 [INFO] [STDOUT] 1.0
      2013-08-24 16:34:51 [INFO] [STDOUT] 1.0
      2013-08-24 16:34:51 [INFO] [STDOUT] 1.0
      2013-08-24 16:34:52 [INFO] [STDOUT] 1.0
      2013-08-24 16:34:52 [INFO] [STDOUT] 1.0
      2013-08-24 16:34:53 [INFO] [STDOUT] 1.0
      2013-08-24 16:34:53 [INFO] [STDOUT] 1.0
      2013-08-24 16:34:55 [INFO] [STDOUT] 1.0
      2013-08-24 16:34:55 [INFO] [STDOUT] 1.0
      2013-08-24 16:34:55 [INFO] [STDOUT] 1.0
      2013-08-24 16:34:57 [INFO] [STDOUT] 1.0
      2013-08-24 16:34:57 [INFO] [STDOUT] 1.0
      2013-08-24 16:35:00 [INFO] [STDOUT] 1.0
      2013-08-24 16:35:01 [INFO] [STDOUT] 1.0
      2013-08-24 16:35:02 [INFO] [STDOUT] 1.0
      2013-08-24 16:35:02 [INFO] [STDOUT] 1.0
      2013-08-24 16:35:02 [INFO] [STDOUT] 1.0
      2013-08-24 16:35:05 [INFO] [STDOUT] 1.0
      2013-08-24 16:35:06 [INFO] [STDOUT] 1.0
      2013-08-24 16:35:06 [INFO] [STDOUT] 1.0
      2013-08-24 16:35:06 [INFO] [STDOUT] 1.0
      2013-08-24 16:35:07 [INFO] [STDOUT] 1.0
      2013-08-24 16:35:09 [INFO] [STDOUT] 1.0
      2013-08-24 16:35:10 [INFO] [STDOUT] 1.0
      2013-08-24 16:35:10 [INFO] [STDOUT] 1.0
      2013-08-24 16:35:10 [INFO] [STDOUT] 1.0
      2013-08-24 16:35:11 [INFO] [STDOUT] 1.0
      2013-08-24 16:35:11 [INFO] [STDOUT] 1.0
      2013-08-24 16:35:11 [INFO] [Minecraft-Server] Saving and pausing game…
      2013-08-24 16:35:11 [INFO] [Minecraft-Server] Saving chunks for level 'test neige'/Overworld
      2013-08-24 16:35:11 [INFO] [Minecraft-Server] Saving chunks for level 'test neige'/Nether
      2013-08-24 16:35:11 [INFO] [Minecraft-Server] Saving chunks for level 'test neige'/The End
      
      

      Et comme ça ne marque pas Failed to registry sound, ça trouve bien les sons
      Si tu peux m’aider
      Merci d’avance

      PS : pas important, mais quand il neige ou il pleut, ça marque dans la console

      [INFO] [STDOUT] 1.0
      

      et quand il fait beau :

      [INFO] [STDOUT] 0.0
      
      1 réponse Dernière réponse Répondre Citer 0
      • robin4002R Hors-ligne
        robin4002 Moddeurs confirmés Rédacteurs Administrateurs
        dernière édition par

        @‘Axaurus’:

        PS : pas important, mais quand il neige ou il pleut, ça marque dans la console

        [INFO] [STDOUT] 1.0
        

        et quand il fait beau :

        [INFO] [STDOUT] 0.0
        

        Oups, ça c’est de ma faute, supprime la ligne System.out.println(mc.theWorld.getRainStrength(1.0F)); je m’en servais pour le débug.
        Le problème vient clairement du son, ça fonctionnait très bien chez moi, et le fait que le 0.0 et le 1.0 s’affiche sur la console est la preuve que le code est exécuté.

        Je suis pas sûr que l’event sound aime les tirets du bas. Essaye de mettre juste christmas (même chose pour le dossier où tu as les sons)

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

          Merci mais il n’y as toujours pas de son.
          J’ai pensé comme toi, j’ai cru que c’était le son, mais non.
          J’ai tester avec un son qui marche parce qu’un de mes mobs l’utilise.
          J’ai enlever les tirets du bas dans les codes et dans le nom du dossier, mais toujours rien.
          Mais pourtant, il trouve le code parce qu’il n’y a pas d’erreur dans la console.
          Donc, ce n’est pas le code parce qu’il y avais les 0.0 et 1.0, et ce n’est pas non plus le son parce que j’ai essayer avec un autre son qui marche dans le mod.
          C’est vraiment bizzare.

          1 réponse Dernière réponse Répondre Citer 0
          • robin4002R Hors-ligne
            robin4002 Moddeurs confirmés Rédacteurs Administrateurs
            dernière édition par

            Ha, c’est peu être car le biome ou tu es la température n’est pas la même. J’ai testé dans un biome taiga.
            Juste avant la condition if(mc.theWorld.isRaining …
            Ajoute :
            System.out.println(biome.getFloatTemperature())
            Si tu obtiens quelque chose d’autres que 0.05F le problème vient de la, il faudrait donc changer la condition :

            if(mc.theWorld.isRaining() && biome.getFloatTemperature() == 0.05F)
            

            par :

            boolean biomeneige = biome.getFloatTemperature() == 0.05F || biome.getFloatTemperature() == autre temperature d un biome neige || biome.getFloatTemperature() == encore un autre
            if(mc.theWorld.isRaining() && biomeneige)
            
            1 réponse Dernière réponse Répondre Citer 1
            • AxaurusA Hors-ligne
              Axaurus
              dernière édition par

              Ca Marche!!
              Merci
              :):D

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

                Salut
                Ce n’est pas important du tout mais serait-il possible de mettre les sons les un après les autres, et sans que ça s’arrête ?
                Car moi, ça met les 4 sons en même temps et ça s’arrête pendant une seconde(je pense que c’est le temps que les sons se recharge)

                Ce n’est pas important du tout, donc si vous ne répondez pas, ce n’est pas grave

                1 réponse Dernière réponse Répondre Citer 0
                • robin4002R Hors-ligne
                  robin4002 Moddeurs confirmés Rédacteurs Administrateurs
                  dernière édition par

                  Non, c’est en rapport avec le random :
                  if(rand.nextInt(15) > 13)
                  Tu as juste à changer ça.

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

                    Et à quoi correspond ces chiffres ?___
                    Parce que que je mette n’importe quel chiffre, c’est pareil(tant que la condition est respecter)

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

                      Personne ne sait à quoi correspond ces chiffres ?

                      1 réponse Dernière réponse Répondre Citer 0
                      • robin4002R Hors-ligne
                        robin4002 Moddeurs confirmés Rédacteurs Administrateurs
                        dernière édition par

                        Dans la description de la section il y a :
                        Vous êtes censé avoir au moins certaines base de Java avant de poster ici.

                        Je vais quand même répondre même si la réponse se trouve facilement sur google.
                        rand.nextInt(nombre) génère un nombre au hasard entre 0 et nombre. Donc dans le cas du code que je t’ai donné, entre 0 et 15. Ensuite c’est juste une condition, si le nombre au hasard est supérieur à 13, il fait le code.

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

                          Salut
                          Merci, mais je savais que c’était une condition. Ce que je voulais dire, c’est que je voulais savoir ce que tu voulais dire par changer les chiffres :

                          Non, c’est en rapport avec le random :
                          if(rand.nextInt(15) > 13)
                          Tu as juste à changer ça.

                          C’est de ma faute, j’ai mal formuler la question. Désolée

                          1 réponse Dernière réponse Répondre Citer 0
                          • robin4002R Hors-ligne
                            robin4002 Moddeurs confirmés Rédacteurs Administrateurs
                            dernière édition par

                            par exemple
                            (rand.nextInt(15) > 3) rendra le son plus fréquent.

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

                              Donc si j’ai bien compris, plus le 1er nombre est proche du deuxième, moins le son se jouera souvent.
                              C’est ça ?___
                              J’ai tester, et ben non
                              Je sais pas pourquoi mais j’ai l’impression que c’est complètement au hasard.

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

                                @‘Axaurus’:

                                J’ai tester, et ben non
                                Je sais pas pourquoi mais j’ai l’impression que c’est complètement au hasard.

                                rand est une instance de random… c’est parfaitement normal que ça soit au hasard

                                Twitter :

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

                                  Salut
                                  Bah, comment je peux faire, alors, pour que la musique se lance qu’une fois que la même musique est fini ?
                                  Je sais pas si j’ai bien expliquer. Donc si vous ne comprenez pas, n’hésitez pas à me demander 😉
                                  Merci

                                  PS : je précise que la musique dure 2 min 33. Je sais pas si ça sera utile.

                                  1 réponse Dernière réponse Répondre Citer 0
                                  • robin4002R Hors-ligne
                                    robin4002 Moddeurs confirmés Rédacteurs Administrateurs
                                    dernière édition par

                                    Dans ce cas il faudrait faire un timer.

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

                                      Je n’ai pas le code de Minecraft sous les yeux mais je peux te mettre sur la piste avec ce que je connais de leur système audio:
                                      Normalement, grâce à Forge, tu devrais pouvoir récupérer une instance de Minecraft.
                                      Une fois cette instance récupérée, fais cet appel:

                                      Minecraft instance = Minecraft.getMinecraft(); // Vieille méthode, je sais pas si elle marche encore
                                      boolean isPlaying = instance.sndManager.sndSystem.playing("NOM DE LA SOURCE DE MUSIQUE");
                                      

                                      pour savoir si la source est toujours en train de jouer.

                                      (Je fais ça de tête, pas sûr que ça marche à 100%)

                                      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
                                      • AxaurusA Hors-ligne
                                        Axaurus
                                        dernière édition par

                                        Salut
                                        Merci
                                        Donc, j’ai créer un timer :

                                        if(timer == 3060)
                                        {
                                        System.out.println("lol");
                                        int i = MathHelper.floor_double(mc.thePlayer.posX);
                                        int k = MathHelper.floor_double(mc.thePlayer.posZ);
                                        int k1 = i + rand.nextInt(10) - rand.nextInt(10);
                                        int l1 = k + rand.nextInt(10) - rand.nextInt(10);
                                        int i2 = mc.theWorld.getPrecipitationHeight(k1, l1);
                                        int j2 = mc.theWorld.getBlockId(k1, i2 - 1, l1);
                                        float f1 = rand.nextFloat();
                                        float f2 = rand.nextFloat();
                                        double d0 = (double)((float)k1 + f1);
                                        double d1 = (double)((float)i2 + 0.1F) - Block.blocksList[j2].getBlockBoundsMinY();
                                        double d2 = (double)((float)l1 + f2);
                                        boolean biomeneige = biome.getFloatTemperature() == 0.05F || biome.getFloatTemperature() == 0.0F;
                                        if(mc.theWorld.isRaining() && biomeneige)
                                        
                                        {
                                        if(d1 > mc.thePlayer.posY + 1.0D && mc.theWorld.getPrecipitationHeight(MathHelper.floor_double(mc.thePlayer.posX), MathHelper.floor_double(mc.thePlayer.posZ)) > MathHelper.floor_double(mc.thePlayer.posY))
                                        {
                                        System.out.println("XD");
                                        mc.theWorld.playSound(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, "halloween:music", 0.1F, 0.5F, false);
                                        }
                                        else
                                        {
                                        mc.theWorld.playSound(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, "halloween:music", 0.2F, 1.0F, false);
                                        }
                                        timer = 0;
                                        }
                                        else {
                                        if ( timer <= nombre_de_tick ) {
                                        timer++;
                                        }
                                        
                                        else { } }
                                        }
                                        

                                        Juste après la condition, j’ai mis le code pour qu’un message s’affiche dans la console
                                        Il s’affiche, donc le code marche bien.
                                        Mais le problème, c’est que la musique ne marche pas.
                                        Après ça, j’ai insérer le code de l’affichage d’un message juste avant le code de la musique, mais ça n’apparaît pas. Donc, y’a un code qui bug.
                                        Si vous pouvez m’aider, …
                                        Merci d’avance

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

                                          Salut
                                          Je suis idiot <_>

                                          En fait, je pense qu’il faut mettre ça :

                                          if(timer == 3060)
                                          {
                                          System.out.println("lol");
                                          {
                                          if(d1 > mc.thePlayer.posY + 1.0D && mc.theWorld.getPrecipitationHeight(MathHelper.floor_double(mc.thePlayer.posX), MathHelper.floor_double(mc.thePlayer.posZ)) > MathHelper.floor_double(mc.thePlayer.posY))
                                          {
                                          System.out.println("XD");
                                          mc.theWorld.playSound(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, "halloween:music", 0.1F, 0.5F, false);
                                          }
                                          else
                                          {
                                          mc.theWorld.playSound(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, "halloween:music", 0.2F, 1.0F, false);
                                          }
                                          timer = 0;
                                          }
                                          else {
                                          if ( timer <= nombre_de_tick ) {
                                          timer++;
                                          }
                                          
                                          else { } }
                                          }
                                          

                                          Je pense qu’il faut plutôt mettre ça.
                                          Mais je ne peux pas tester, je ne suis pas encore chez moi.
                                          Je vous tient au courant du message.
                                          Mais si vous avez une meilleure réponse, n’hésitez pas à poster 😉

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

                                            Non, ça ne marche pas
                                            J’ai mis ça : ```java
                                            if(timer == 3060)
                                            {
                                            System.out.println(“lol”);
                                            int i = MathHelper.floor_double(mc.thePlayer.posX);
                                            int k = MathHelper.floor_double(mc.thePlayer.posZ);
                                            int k1 = i + rand.nextInt(10) - rand.nextInt(10);
                                            int l1 = k + rand.nextInt(10) - rand.nextInt(10);
                                            int i2 = mc.theWorld.getPrecipitationHeight(k1, l1);
                                            int j2 = mc.theWorld.getBlockId(k1, i2 - 1, l1);
                                            float f1 = rand.nextFloat();
                                            float f2 = rand.nextFloat();
                                            double d0 = (double)((float)k1 + f1);
                                            double d1 = (double)((float)i2 + 0.1F) - Block.blocksList[j2].getBlockBoundsMinY();
                                            double d2 = (double)((float)l1 + f2);
                                            boolean biomeneige = biome.getFloatTemperature() == 0.05F || biome.getFloatTemperature() == 0.0F;
                                            if(d1 > mc.thePlayer.posY + 1.0D && mc.theWorld.getPrecipitationHeight(MathHelper.floor_double(mc.thePlayer.posX), MathHelper.floor_double(mc.thePlayer.posZ)) > MathHelper.floor_double(mc.thePlayer.posY))
                                            {
                                            System.out.println(“XD”);

                                            mc.theWorld.playSound(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, “halloween:music”, 0.1F, 0.5F, false);
                                            }
                                            else
                                            {
                                            mc.theWorld.playSound(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, “halloween:music”, 0.2F, 1.0F, false);
                                            }
                                            timer = 0;
                                            }
                                            else {
                                            if ( timer <= nombre_de_tick ) {
                                            timer++;
                                            }

                                            else { } }
                                            }

                                            
                                            Si un de vous à proposez, n'hésitez pas ;)
                                            Merci d'avance___
                                            Si en fait, ça marche
                                            J'ai juste oublier d'activer le son de mon casque lol
                                            je suis nul
                                            
                                            En tout cas, voici les lignes de codes si ça peut en aider certain :
                                            Dans l'initialisation du mod :```java
                                            TickRegistry.registerTickHandler(new ClientTickHandler(), Side.CLIENT);
                                            

                                            Dans le ClientTickHandler :

                                            package This_is_Halloween;
                                            
                                            import java.util.EnumSet;
                                            import java.util.Random;
                                            
                                            import net.minecraft.block.Block;
                                            import net.minecraft.client.Minecraft;
                                            import net.minecraft.util.MathHelper;
                                            import net.minecraft.world.biome.BiomeGenBase;
                                            import cpw.mods.fml.client.FMLClientHandler;
                                            import cpw.mods.fml.common.ITickHandler;
                                            import cpw.mods.fml.common.TickType;
                                            
                                            public class ClientTickHandler implements ITickHandler
                                            {
                                            public int timer = 3060;
                                            public int nombre_de_tick = 3060;
                                            @Override
                                            public void tickStart(EnumSet <ticktype>type, Object… tickData)
                                            {
                                            
                                            }
                                            
                                            @Override
                                            public void tickEnd(EnumSet <ticktype>type, Object... tickData)
                                            {
                                            Minecraft mc = FMLClientHandler.instance().getClient();
                                            Random rand = mc.theWorld.rand;
                                            BiomeGenBase biome = mc.theWorld.getBiomeGenForCoords((int)mc.thePlayer.posX, (int)mc.thePlayer.posZ);
                                            final Minecraft minecraft = FMLClientHandler.instance().getClient();
                                            if (type.equals(EnumSet.of(TickType.PLAYER)))
                                            {
                                            
                                            }
                                            
                                            if(timer == 3060) //3060 ticks = 2 minutes 33
                                            {
                                            System.out.println("lol");
                                            int i = MathHelper.floor_double(mc.thePlayer.posX);
                                            int k = MathHelper.floor_double(mc.thePlayer.posZ);
                                            int k1 = i + rand.nextInt(10) - rand.nextInt(10);
                                            int l1 = k + rand.nextInt(10) - rand.nextInt(10);
                                            int i2 = mc.theWorld.getPrecipitationHeight(k1, l1);
                                            int j2 = mc.theWorld.getBlockId(k1, i2 - 1, l1);
                                            float f1 = rand.nextFloat();
                                            float f2 = rand.nextFloat();
                                            double d0 = (double)((float)k1 + f1);
                                            double d1 = (double)((float)i2 + 0.1F) - Block.blocksList[j2].getBlockBoundsMinY();
                                            double d2 = (double)((float)l1 + f2);
                                            boolean biomeneige = biome.getFloatTemperature() == 0.05F || biome.getFloatTemperature() == 0.0F;
                                            if(d1 > mc.thePlayer.posY + 1.0D && mc.theWorld.getPrecipitationHeight(MathHelper.floor_double(mc.thePlayer.posX), MathHelper.floor_double(mc.thePlayer.posZ)) > MathHelper.floor_double(mc.thePlayer.posY))
                                            {
                                            System.out.println("XD");
                                            
                                            mc.theWorld.playSound(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, "halloween:music", 0.1F, 0.5F, false);
                                            }
                                            else
                                            {
                                            mc.theWorld.playSound(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, "halloween:music", 0.2F, 1.0F, false);
                                            }
                                            timer = 0;
                                            }
                                            else {
                                            if ( timer <= nombre_de_tick ) {
                                            timer++;
                                            }
                                            
                                            else { } }
                                            }
                                            
                                            @Override
                                            public EnumSet <ticktype>ticks()
                                            {
                                            return EnumSet.of(TickType.PLAYER);
                                            }
                                            
                                            @Override
                                            public String getLabel()
                                            {
                                            return "test";
                                            }
                                            }
                                            ```</ticktype></ticktype></ticktype>
                                            1 réponse Dernière réponse Répondre Citer 0
                                            • 1
                                            • 2
                                            • 1 / 2
                                            • Premier message
                                              Dernier message
                                            Design by Woryk
                                            ContactMentions Légales

                                            MINECRAFT FORGE FRANCE © 2024

                                            Powered by NodeBB