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
      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
        • robin4002R Hors-ligne
          robin4002 Moddeurs confirmés Rédacteurs Administrateurs
          dernière édition par

          Ok, du coup c’est définitivement résolu, bravo à toi pour ton travail de recherche jusqu’à résoudre le problème tout seul, tous les codeurs devrait faire ça, de toute façon c’est comme ça qu’on réussi, en continuant à chercher jusqu’à que ça fonctionne comme on veut 😉

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

          MINECRAFT FORGE FRANCE © 2024

          Powered by NodeBB