MFF

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

    Le Son de La Neige - dernier problème

    Planifier Épinglé Verrouillé Déplacé Résolu Anciennes versions
    1.6.2
    3 Messages 2 Publieurs 1.4k 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
      J’ai un problème avec la neige(lol, mais ça sera le dernier problème avec la neige j’espère(si vous ne comprenez pas, allez voir tout les sujets que j’ai commencer avec la neige et vous comprendrez)) :

      En fait, j’ai mis un timer, ça marchais.
      Mais aujourd’hui, ça n’a plus envie de marcher alors qu’il neige.

      Voici mon ClientTickHandler :

      package This_is_Christmas;
      
      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 = 32;
      public int nombre_de_tick = 32;
      @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)))
      {
      
      }
      System.out.println(timer);
      if(timer == 32)
      {
      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())
      {
      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, "christmas:snow", 0.1F, 0.5F, false);
      }
      else
      {
      mc.theWorld.playSound(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, "christmas:snow", 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";
      }
      }
      

      Merci d’avance

      PS : Aussi, dans la console, j’ai mis pour que ça affiche le timer : sauf que le timer reste sur 33(pas logique, puisque dans le code, il n’y a pas de 33 ni de 32 + )</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

        Normal,
        if(timer <= nombre_de_tick)
        Ici quand ton jeu se lance, ça va faire if(32 <= 32)
        donc forcement ça return true, et il fait timer++;

        La condition de ton timer n’est pas placé au bon endroit, même chose pour la condition du type.equals(EnumSet.of(TickType.PLAYER) :

        if(type.equals(EnumSet.of(TickType.PLAYER)))
        {
        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(timer == 32)
        {
        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())
        {
        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, "christmas:snow", 0.1F, 0.5F, false);
        }
        else
        {
        mc.theWorld.playSound(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, "christmas:snow", 0.2F, 1.0F, false);
        }
        timer = 0;
        }
        }
        else if(timer < nombre_de_tick)
        {
        timer++;
        }
        
        }
        
        1 réponse Dernière réponse Répondre Citer 0
        • AxaurusA Hors-ligne
          Axaurus
          dernière édition par

          Salut
          Merci ça marche
          Mais je comprend pas pourquoi jeudi, ça marchais et plus hier.
          C’est pas grave
          Merci 🙂

          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