MFF

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

    Ajout du FOG dans un biome

    Planifier Épinglé Verrouillé Déplacé Sans suite
    20 Messages 4 Publieurs 4.9k 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.
    • S Hors-ligne
      sisidney
      dernière édition par

      Merci ! 🙂
      Je pence avoir trouvé ce qui m’intersse:

      /**
      * Sets up the fog to be rendered. If the arg passed in is -1 the fog starts at 0 and goes to 80% of far plane
      * distance and is used for sky rendering.
      */
      private void setupFog(int par1, float par2)
      {
      EntityLivingBase entitylivingbase = this.mc.renderViewEntity;
      boolean flag = false;
      
      if (entitylivingbase instanceof EntityPlayer)
      {
      flag = ((EntityPlayer)entitylivingbase).capabilities.isCreativeMode;
      }
      
      if (par1 == 999)
      {
      GL11.glFog(GL11.GL_FOG_COLOR, this.setFogColorBuffer(0.0F, 0.0F, 0.0F, 1.0F));
      GL11.glFogi(GL11.GL_FOG_MODE, GL11.GL_LINEAR);
      GL11.glFogf(GL11.GL_FOG_START, 0.0F);
      GL11.glFogf(GL11.GL_FOG_END, 8.0F);
      
      if (GLContext.getCapabilities().GL_NV_fog_distance)
      {
      GL11.glFogi(34138, 34139);
      }
      
      GL11.glFogf(GL11.GL_FOG_START, 0.0F);
      }
      else
      {
      GL11.glFog(GL11.GL_FOG_COLOR, this.setFogColorBuffer(this.fogColorRed, this.fogColorGreen, this.fogColorBlue, 1.0F));
      GL11.glNormal3f(0.0F, -1.0F, 0.0F);
      GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
      int j = ActiveRenderInfo.getBlockIdAtEntityViewpoint(this.mc.theWorld, entitylivingbase, par2);
      float f1;
      
      if (entitylivingbase.isPotionActive(Potion.blindness))
      {
      f1 = 5.0F;
      int k = entitylivingbase.getActivePotionEffect(Potion.blindness).getDuration();
      
      if (k < 20)
      {
      f1 = 5.0F + (this.farPlaneDistance - 5.0F) * (1.0F - (float)k / 20.0F);
      }
      
      GL11.glFogi(GL11.GL_FOG_MODE, GL11.GL_LINEAR);
      
      if (par1 < 0)
      {
      GL11.glFogf(GL11.GL_FOG_START, 0.0F);
      GL11.glFogf(GL11.GL_FOG_END, f1 * 0.8F);
      }
      else
      {
      GL11.glFogf(GL11.GL_FOG_START, f1 * 0.25F);
      GL11.glFogf(GL11.GL_FOG_END, f1);
      }
      
      if (GLContext.getCapabilities().GL_NV_fog_distance)
      {
      GL11.glFogi(34138, 34139);
      }
      }
      else if (this.cloudFog)
      {
      GL11.glFogi(GL11.GL_FOG_MODE, GL11.GL_EXP);
      GL11.glFogf(GL11.GL_FOG_DENSITY, 0.1F);
      }
      else if (j > 0 && Block.blocksList[j].blockMaterial == Material.water)
      {
      GL11.glFogi(GL11.GL_FOG_MODE, GL11.GL_EXP);
      
      if (entitylivingbase.isPotionActive(Potion.waterBreathing))
      {
      GL11.glFogf(GL11.GL_FOG_DENSITY, 0.05F);
      }
      else
      {
      GL11.glFogf(GL11.GL_FOG_DENSITY, 0.1F - (float)EnchantmentHelper.getRespiration(entitylivingbase) * 0.03F);
      }
      }
      else if (j > 0 && Block.blocksList[j].blockMaterial == Material.lava)
      {
      GL11.glFogi(GL11.GL_FOG_MODE, GL11.GL_EXP);
      GL11.glFogf(GL11.GL_FOG_DENSITY, 2.0F);
      }
      else
      {
      f1 = this.farPlaneDistance;
      
      if (this.mc.theWorld.provider.getWorldHasVoidParticles() && !flag)
      {
      double d0 = (double)((entitylivingbase.getBrightnessForRender(par2) & 15728640) >> 20) / 16.0D + (entitylivingbase.lastTickPosY + (entitylivingbase.posY - entitylivingbase.lastTickPosY) * (double)par2 + 4.0D) / 32.0D;
      
      if (d0 < 1.0D)
      {
      if (d0 < 0.0D)
      {
      d0 = 0.0D;
      }
      
      d0 *= d0;
      float f2 = 100.0F * (float)d0;
      
      if (f2 < 5.0F)
      {
      f2 = 5.0F;
      }
      
      if (f1 > f2)
      {
      f1 = f2;
      }
      }
      }
      
      GL11.glFogi(GL11.GL_FOG_MODE, GL11.GL_LINEAR);
      
      if (par1 < 0)
      {
      GL11.glFogf(GL11.GL_FOG_START, 0.0F);
      GL11.glFogf(GL11.GL_FOG_END, f1 * 0.8F);
      }
      else
      {
      GL11.glFogf(GL11.GL_FOG_START, f1 * 0.25F);
      GL11.glFogf(GL11.GL_FOG_END, f1);
      }
      
      if (GLContext.getCapabilities().GL_NV_fog_distance)
      {
      GL11.glFogi(34138, 34139);
      }
      
      if (this.mc.theWorld.provider.doesXZShowFog((int)entitylivingbase.posX, (int)entitylivingbase.posZ))
      {
      GL11.glFogf(GL11.GL_FOG_START, f1 * 0.05F);
      GL11.glFogf(GL11.GL_FOG_END, Math.min(f1, 192.0F) * 0.5F);
      }
      }
      
      GL11.glEnable(GL11.GL_COLOR_MATERIAL);
      GL11.glColorMaterial(GL11.GL_FRONT, GL11.GL_AMBIENT);
      }
      }
      
      

      Mais par contre je n’est aucun idée de comment appliquer ça au joueur qui est dans le biome. 😕

      1 réponse Dernière réponse Répondre Citer 0
      • isadorI Hors-ligne
        isador Moddeurs confirmés Modérateurs
        dernière édition par

        Tu met ça dans la classe de ton biome et tu fais un updateTick

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

          Merci mais je ne comprend rien au :

          GL11.GL_FOG_MOD
          GL11.GL_FOG_COLOR
          GL11.GL_FOG_START
          GL11.GL_FOG_END
          GL11.GL_FOG
          GL11.GL_FOG_DENSITY
          
          1 réponse Dernière réponse Répondre Citer 0
          • isadorI Hors-ligne
            isador Moddeurs confirmés Modérateurs
            dernière édition par

            c’est les différent paramètre du fog

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

              Oui mais comment on peut bien réglé c’est paramètre?

              De plus toute les chose que j’essaye de faire n’ont aucun effet mit appart de faire lag:

              private FloatBuffer setFogColorBuffer(float par1, float par2, float par3, float par4)
              {
              this.fogColorBuffer.clear();
              this.fogColorBuffer.put(par1).put(par2).put(par3).put(par4);
              this.fogColorBuffer.flip();
              return this.fogColorBuffer;
              }
              public void updateTick(World world, int x, int y, int z)
              {
              
              GL11.glFog(GL11.GL_FOG_COLOR, this.setFogColorBuffer(0.0F, 0.0F, 0.0F, 1.0F));
              GL11.glFogi(GL11.GL_FOG_MODE, GL11.GL_LINEAR);
              GL11.glFogf(GL11.GL_FOG_START, 0.0F);
              GL11.glFogf(GL11.GL_FOG_END, 8.0F);
              System.out.println("Test!");
              }
              
              
              1 réponse Dernière réponse Répondre Citer 0
              • isadorI Hors-ligne
                isador Moddeurs confirmés Modérateurs
                dernière édition par

                Alors la je sais pas j’ai jamais test le fog

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

                  Pas grave,je vais continuer de chercher:)

                  1 réponse Dernière réponse Répondre Citer 0
                  • isadorI Hors-ligne
                    isador Moddeurs confirmés Modérateurs
                    dernière édition par

                    ok prévient moi si tu y arrive

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

                      Ok np 🙂


                      De toute façon si je y arrive je pence faire un tuto plus poussé pour les biomes en 1.6 🙂

                      1 réponse Dernière réponse Répondre Citer 0
                      • isadorI Hors-ligne
                        isador Moddeurs confirmés Modérateurs
                        dernière édition par

                        ok merci ^^

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

                          J’ai enfin trouvé comment a fais le coddeur de biome o plenty tout est dans cette importe :

                          import worldcore.interfaces.IWCFog;
                          
                          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