Navigation

    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

    SOLVED Class des Effets de Potions

    1.7.x
    1.7.10
    5
    19
    3787
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • sosoh
      sosoh last edited by

      Bonjour, apres de longues recherches, impossibles de mettre la main sur la (les) class des effets de potions sauf pour celle de heal, hunger etc… Mais moi j’ai besoin de toutes qu’il n’y sont pas^^ (ex: night visons, blindness, slowness etc) Savez-vous comment les trouver ?

      1 Reply Last reply Reply Quote 0
      • D
        Degraduck last edited by

        Si c’est juste pour recopier du code, tu peux prendre MCP pour avoir accès au code de toutes le classes vanilla.

        1 Reply Last reply Reply Quote 0
        • sosoh
          sosoh last edited by

          MCP ?

          1 Reply Last reply Reply Quote 0
          • Deleted
            Deleted last edited by

            @‘sosoh’:

            MCP ?

            Minecraft Coder Pack et google ça te dit quelque chose ?

            1 Reply Last reply Reply Quote 0
            • robin4002
              robin4002 Administrateurs Rédacteurs Moddeurs confirmés last edited by

              ? Vous racontez n’importe quoi. Avec le setupDecompWorkspace vous avez toutes les sources de mc, utiliser mcp n’a aucun sens.

              Toutes les potions sont déclarés dans la classe Potion.java, et la plupart des potions réutilise cette même classe, c’est pour ça que tu ne trouve pas les classes des autres potions, tous simplement car elles n’en ont pas.

              1 Reply Last reply Reply Quote 0
              • sosoh
                sosoh last edited by

                Ah mais alors comment je trouves le code pour faire du blindness ou des choses comme ca ? Car je veux créer un effet qui combine plusieurs trucs ^^

                1 Reply Last reply Reply Quote 0
                • Superloup10
                  Superloup10 Modérateurs last edited by

                  Tu regardes où la variable blindness est appelé.

                  1 Reply Last reply Reply Quote 0
                  • sosoh
                    sosoh last edited by

                    J’y ai déjà penser mais il n’y a que:

                    ​public static final Potion blindness = (new Potion(15, true, 2039587)).setPotionName("potion.blindness").setIconIndex(5, 1).setEffectiveness(0.25D);
                    
                    1 Reply Last reply Reply Quote 0
                    • robin4002
                      robin4002 Administrateurs Rédacteurs Moddeurs confirmés last edited by

                      Sélectionne blindness et fait une recherche Java …

                      1 Reply Last reply Reply Quote 0
                      • sosoh
                        sosoh last edited by

                        Ah j’ai trouvé mais le code use des declarations qui meme si je les copies avec les dependances etc ne marche pas

                        1 Reply Last reply Reply Quote 0
                        • robin4002
                          robin4002 Administrateurs Rédacteurs Moddeurs confirmés last edited by

                          Envoie le code ?

                          1 Reply Last reply Reply Quote 0
                          • sosoh
                            sosoh last edited by

                            Il y a 2 choses qui sont dans la classe (net.minecraft.client.renderer.EntityRenderer):

                            ​
                                    WorldClient worldclient = this.mc.theWorld;
                            
                                    double d0 = (entitylivingbase.lastTickPosY + (entitylivingbase.posY - entitylivingbase.lastTickPosY) * (double)p_78466_1_) * worldclient.provider.getVoidFogYFactor();
                            
                                    if (entitylivingbase.isPotionActive(Potion.blindness))
                                    {
                                        int i = entitylivingbase.getActivePotionEffect(Potion.blindness).getDuration();
                            
                                        if (i < 20)
                                        {
                                            d0 *= (double)(1.0F - (float)i / 20.0F);
                                        }
                                        else
                                        {
                                            d0 = 0.0D;
                                        }
                                    }
                            ]
                            

                            Code semi-complet:
                            :::

                            ​private void updateFogColor(float p_78466_1_)
                            
                                {
                                    WorldClient worldclient = this.mc.theWorld;
                                    EntityLivingBase entitylivingbase = this.mc.renderViewEntity;
                                    float f1 = 0.25F + 0.75F * (float)this.mc.gameSettings.renderDistanceChunks / 16.0F;
                                    f1 = 1.0F - (float)Math.pow((double)f1, 0.25D);
                                    Vec3 vec3 = worldclient.getSkyColor(this.mc.renderViewEntity, p_78466_1_);
                                    float f2 = (float)vec3.xCoord;
                                    float f3 = (float)vec3.yCoord;
                                    float f4 = (float)vec3.zCoord;
                                    Vec3 vec31 = worldclient.getFogColor(p_78466_1_);
                                    this.fogColorRed = (float)vec31.xCoord;
                                    this.fogColorGreen = (float)vec31.yCoord;
                                    this.fogColorBlue = (float)vec31.zCoord;
                                    float f5;
                            
                                    if (this.mc.gameSettings.renderDistanceChunks >= 4)
                                    {
                                        Vec3 vec32 = MathHelper.sin(worldclient.getCelestialAngleRadians(p_78466_1_)) > 0.0F ? Vec3.createVectorHelper(-1.0D, 0.0D, 0.0D) : Vec3.createVectorHelper(1.0D, 0.0D, 0.0D);
                                        f5 = (float)entitylivingbase.getLook(p_78466_1_).dotProduct(vec32);
                            
                                        if (f5 < 0.0F)
                                        {
                                            f5 = 0.0F;
                                        }
                            
                                        if (f5 > 0.0F)
                                        {
                                            float[] afloat = worldclient.provider.calcSunriseSunsetColors(worldclient.getCelestialAngle(p_78466_1_), p_78466_1_);
                            
                                            if (afloat != null)
                                            {
                                                f5 *= afloat[3];
                                                this.fogColorRed = this.fogColorRed * (1.0F - f5) + afloat[0] * f5;
                                                this.fogColorGreen = this.fogColorGreen * (1.0F - f5) + afloat[1] * f5;
                                                this.fogColorBlue = this.fogColorBlue * (1.0F - f5) + afloat[2] * f5;
                                            }
                                        }
                                    }
                            
                                    this.fogColorRed += (f2 - this.fogColorRed) * f1;
                                    this.fogColorGreen += (f3 - this.fogColorGreen) * f1;
                                    this.fogColorBlue += (f4 - this.fogColorBlue) * f1;
                                    float f8 = worldclient.getRainStrength(p_78466_1_);
                                    float f9;
                            
                                    if (f8 > 0.0F)
                                    {
                                        f5 = 1.0F - f8 * 0.5F;
                                        f9 = 1.0F - f8 * 0.4F;
                                        this.fogColorRed *= f5;
                                        this.fogColorGreen *= f5;
                                        this.fogColorBlue *= f9;
                                    }
                            
                                    f5 = worldclient.getWeightedThunderStrength(p_78466_1_);
                            
                                    if (f5 > 0.0F)
                                    {
                                        f9 = 1.0F - f5 * 0.5F;
                                        this.fogColorRed *= f9;
                                        this.fogColorGreen *= f9;
                                        this.fogColorBlue *= f9;
                                    }
                            
                                    Block block = ActiveRenderInfo.getBlockAtEntityViewpoint(this.mc.theWorld, entitylivingbase, p_78466_1_);
                                    float f10;
                            
                                    if (this.cloudFog)
                                    {
                                        Vec3 vec33 = worldclient.getCloudColour(p_78466_1_);
                                        this.fogColorRed = (float)vec33.xCoord;
                                        this.fogColorGreen = (float)vec33.yCoord;
                                        this.fogColorBlue = (float)vec33.zCoord;
                                    }
                                    else if (block.getMaterial() == Material.water)
                                    {
                                        f10 = (float)EnchantmentHelper.getRespiration(entitylivingbase) * 0.2F;
                                        this.fogColorRed = 0.02F + f10;
                                        this.fogColorGreen = 0.02F + f10;
                                        this.fogColorBlue = 0.2F + f10;
                                    }
                                    else if (block.getMaterial() == Material.lava)
                                    {
                                        this.fogColorRed = 0.6F;
                                        this.fogColorGreen = 0.1F;
                                        this.fogColorBlue = 0.0F;
                                    }
                            
                                    f10 = this.fogColor2 + (this.fogColor1 - this.fogColor2) * p_78466_1_;
                                    this.fogColorRed *= f10;
                                    this.fogColorGreen *= f10;
                                    this.fogColorBlue *= f10;
                                    double d0 = (entitylivingbase.lastTickPosY + (entitylivingbase.posY - entitylivingbase.lastTickPosY) * (double)p_78466_1_) * worldclient.provider.getVoidFogYFactor();
                            
                                    if (entitylivingbase.isPotionActive(Potion.blindness))
                                    {
                                        int i = entitylivingbase.getActivePotionEffect(Potion.blindness).getDuration();
                            
                                        if (i < 20)
                                        {
                                            d0 *= (double)(1.0F - (float)i / 20.0F);
                                        }
                                        else
                                        {
                                            d0 = 0.0D;
                                        }
                                    }
                            
                                    if (d0 < 1.0D)
                                    {
                                        if (d0 < 0.0D)
                                        {
                                            d0 = 0.0D;
                                        }
                            
                                        d0 *= d0;
                                        this.fogColorRed = (float)((double)this.fogColorRed * d0);
                                        this.fogColorGreen = (float)((double)this.fogColorGreen * d0);
                                        this.fogColorBlue = (float)((double)this.fogColorBlue * d0);
                                    }
                            
                                    float f11;
                            
                                    if (this.bossColorModifier > 0.0F)
                                    {
                                        f11 = this.bossColorModifierPrev + (this.bossColorModifier - this.bossColorModifierPrev) * p_78466_1_;
                                        this.fogColorRed = this.fogColorRed * (1.0F - f11) + this.fogColorRed * 0.7F * f11;
                                        this.fogColorGreen = this.fogColorGreen * (1.0F - f11) + this.fogColorGreen * 0.6F * f11;
                                        this.fogColorBlue = this.fogColorBlue * (1.0F - f11) + this.fogColorBlue * 0.6F * f11;
                                    }
                            
                                    float f6;
                            
                                    if (entitylivingbase.isPotionActive(Potion.nightVision))
                                    {
                                        f11 = this.getNightVisionBrightness(this.mc.thePlayer, p_78466_1_);
                                        f6 = 1.0F / this.fogColorRed;
                            
                                        if (f6 > 1.0F / this.fogColorGreen)
                                        {
                                            f6 = 1.0F / this.fogColorGreen;
                                        }
                            
                                        if (f6 > 1.0F / this.fogColorBlue)
                                        {
                                            f6 = 1.0F / this.fogColorBlue;
                                        }
                            
                                        this.fogColorRed = this.fogColorRed * (1.0F - f11) + this.fogColorRed * f6 * f11;
                                        this.fogColorGreen = this.fogColorGreen * (1.0F - f11) + this.fogColorGreen * f6 * f11;
                                        this.fogColorBlue = this.fogColorBlue * (1.0F - f11) + this.fogColorBlue * f6 * f11;
                                    }
                            
                                    if (this.mc.gameSettings.anaglyph)
                                    {
                                        f11 = (this.fogColorRed * 30.0F + this.fogColorGreen * 59.0F + this.fogColorBlue * 11.0F) / 100.0F;
                                        f6 = (this.fogColorRed * 30.0F + this.fogColorGreen * 70.0F) / 100.0F;
                                        float f7 = (this.fogColorRed * 30.0F + this.fogColorBlue * 70.0F) / 100.0F;
                                        this.fogColorRed = f11;
                                        this.fogColorGreen = f6;
                                        this.fogColorBlue = f7;
                                    }
                            
                                    net.minecraftforge.client.event.EntityViewRenderEvent.FogColors event = new net.minecraftforge.client.event.EntityViewRenderEvent.FogColors(this, entitylivingbase, block, p_78466_1_, this.fogColorRed, this.fogColorGreen, this.fogColorBlue);
                                    MinecraftForge.EVENT_BUS.post(event);
                            
                                    this.fogColorRed = event.red;
                                    this.fogColorBlue = event.blue;
                                    this.fogColorGreen = event.green;
                            
                                    GL11.glClearColor(this.fogColorRed, this.fogColorGreen, this.fogColorBlue, 0.0F);
                                }
                            

                            :::

                            ​if (entitylivingbase.isPotionActive(Potion.blindness))
                            
                                        {
                                            f1 = 5.0F;
                                            int j = entitylivingbase.getActivePotionEffect(Potion.blindness).getDuration();
                            
                                            if (j < 20)
                                            {
                                                f1 = 5.0F + (this.farPlaneDistance - 5.0F) * (1.0F - (float)j / 20.0F);
                                            }
                            
                                            GL11.glFogi(GL11.GL_FOG_MODE, GL11.GL_LINEAR);
                            
                                            if (p_78468_1_ < 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);
                                            }
                                        }
                            

                            Code semi complet:
                            :::

                            ​private void setupFog(int p_78468_1_, float p_78468_2_)
                            
                                {
                                    EntityLivingBase entitylivingbase = this.mc.renderViewEntity;
                                    boolean flag = false;
                            
                                    if (entitylivingbase instanceof EntityPlayer)
                                    {
                                        flag = ((EntityPlayer)entitylivingbase).capabilities.isCreativeMode;
                                    }
                            
                                    if (p_78468_1_ == 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);
                                        Block block = ActiveRenderInfo.getBlockAtEntityViewpoint(this.mc.theWorld, entitylivingbase, p_78468_2_);
                                        float f1;
                            
                                        net.minecraftforge.client.event.EntityViewRenderEvent.FogDensity event = new net.minecraftforge.client.event.EntityViewRenderEvent.FogDensity(this, entitylivingbase, block, p_78468_2_, 0.1F);
                            
                                        if (MinecraftForge.EVENT_BUS.post(event))
                                        {
                                            GL11.glFogf(GL11.GL_FOG_DENSITY, event.density);
                                        }
                                        else
                                        if (entitylivingbase.isPotionActive(Potion.blindness))
                                        {
                                            f1 = 5.0F;
                                            int j = entitylivingbase.getActivePotionEffect(Potion.blindness).getDuration();
                            
                                            if (j < 20)
                                            {
                                                f1 = 5.0F + (this.farPlaneDistance - 5.0F) * (1.0F - (float)j / 20.0F);
                                            }
                            
                                            GL11.glFogi(GL11.GL_FOG_MODE, GL11.GL_LINEAR);
                            
                                            if (p_78468_1_ < 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 (block.getMaterial() == 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 (block.getMaterial() == 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(p_78468_2_) & 15728640) >> 20) / 16.0D + (entitylivingbase.lastTickPosY + (entitylivingbase.posY - entitylivingbase.lastTickPosY) * (double)p_78468_2_ + 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 (p_78468_1_ < 0)
                                            {
                                                GL11.glFogf(GL11.GL_FOG_START, 0.0F);
                                                GL11.glFogf(GL11.GL_FOG_END, f1);
                                            }
                                            else
                                            {
                                                GL11.glFogf(GL11.GL_FOG_START, f1 * 0.75F);
                                                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);
                                            }
                                            MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.EntityViewRenderEvent.RenderFogEvent(this, entitylivingbase, block, p_78468_2_, p_78468_1_, f1));
                                        }
                            
                                        GL11.glEnable(GL11.GL_COLOR_MATERIAL);
                                        GL11.glColorMaterial(GL11.GL_FRONT, GL11.GL_AMBIENT);
                                    }
                                }
                            

                            :::

                            1 Reply Last reply Reply Quote 0
                            • robin4002
                              robin4002 Administrateurs Rédacteurs Moddeurs confirmés last edited by

                              Visiblement forge a tout prévu, tu peux utiliser les event :
                              EntityViewRenderEvent.RenderFogEvent
                              EntityViewRenderEvent.FogColors

                              Pour refaire la même chose.

                              1 Reply Last reply Reply Quote 0
                              • sosoh
                                sosoh last edited by

                                Ah ok merci, je vais essayer de trouver les mêmes classes avec la slowness et faire mon effet

                                1 Reply Last reply Reply Quote 0
                                • sosoh
                                  sosoh last edited by

                                  Salut, je n’arrive pas a reproduire l’effet blindness on peut m’aider ?

                                  1 Reply Last reply Reply Quote 0
                                  • robin4002
                                    robin4002 Administrateurs Rédacteurs Moddeurs confirmés last edited by

                                    Envoie ton code actuel.

                                    1 Reply Last reply Reply Quote 0
                                    • sosoh
                                      sosoh last edited by

                                      Mais en faite je ne sais pas comment adapter le code de la classe à mon utilisation … 😞

                                      Mon code:

                                      ​@SubscribeEvent
                                      
                                      public void RenderFogEvent(EntityViewRenderEvent.RenderFogEvent event){
                                      
                                                  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);
                                                  float f1;
                                      
                                                  if (event.entity.isPotionActive(SomnolenceEffect.somnolenceEffectID))
                                                  {
                                                      f1 = 5.0F;
                                                      int j = event.entity.getActivePotionEffect(SomnolenceEffect.somnolenceEffect).getDuration();
                                      
                                                      if (j < 20)
                                                      {
                                                          f1 = 5.0F + (event.farPlaneDistance - 5.0F) * (1.0F - (float)j / 20.0F);
                                                      }
                                      
                                                      GL11.glFogi(GL11.GL_FOG_MODE, GL11.GL_LINEAR);
                                      
                                                      if (event.fogMode < 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);
                                                      }
                                                  }
                                      
                                              }
                                      

                                      J’arrive pas a adapter le

                                      GL11.glFog(GL11.GL_FOG_COLOR, this.setFogColorBuffer(this.fogColorRed, this.fogColorGreen, this.fogColorBlue, 1.0F));
                                      

                                      (Tu peux deplacer ca dans le non resolu stp?)

                                      1 Reply Last reply Reply Quote 0
                                      • robin4002
                                        robin4002 Administrateurs Rédacteurs Moddeurs confirmés last edited by

                                        Tu n’es pas très loin de la solution. En fait cette partie du code ne sert à rien. Il faut prendre seulement le code qui fait le brouillard. J’ai fait quelques tests de mon côté avec la potion de force (premier truc que j’ai trouvé). Voila ce que ça donne :

                                        ​    @SubscribeEvent
                                        
                                            @SideOnly(Side.CLIENT)
                                            public void onFogRender(EntityViewRenderEvent.RenderFogEvent event)
                                            {
                                                if(event.entity.isPotionActive(Potion.damageBoost.id))
                                                {
                                                    float f1 = 5.0F;
                                                    int j = event.entity.getActivePotionEffect(Potion.damageBoost).getDuration();
                                        
                                                    if(j < 20)
                                                    {
                                                        f1 = 5.0F + (event.farPlaneDistance - 5.0F) * (1.0F - (float)j / 20.0F);
                                                    }
                                        
                                                    GL11.glFogi(GL11.GL_FOG_MODE, GL11.GL_LINEAR);
                                        
                                                    if(event.fogMode < 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);
                                                    }
                                                }
                                            }
                                        

                                        Suffit juste de changer Potion.damageBoost par ta potion.
                                        Par contre le brouillard sera tout blanc, donc il faut passer par un second event :

                                        ​    @SubscribeEvent
                                        
                                            @SideOnly(Side.CLIENT)
                                            public void getFogColor(EntityViewRenderEvent.FogColors event)
                                            {
                                                if(event.entity.isPotionActive(Potion.damageBoost.id))
                                                {
                                                    double d0 = (event.entity.lastTickPosY + (event.entity.posY - event.entity.lastTickPosY) * (double)event.renderPartialTicks) * FMLClientHandler.instance().getWorldClient().provider.getVoidFogYFactor();
                                        
                                                    int i = event.entity.getActivePotionEffect(Potion.damageBoost).getDuration();
                                        
                                                    if(i < 20)
                                                    {
                                                        d0 *= (double)(1.0F - (float)i / 20.0F);
                                                    }
                                                    else
                                                    {
                                                        d0 = 0.0D;
                                                    }
                                        
                                                    if(d0 < 1.0D)
                                                    {
                                                        if(d0 < 0.0D)
                                                        {
                                                            d0 = 0.0D;
                                                        }
                                        
                                                        d0 *= d0;
                                                        event.red = (float)((double)event.red * d0);
                                                        event.green = (float)((double)event.green * d0);
                                                        event.blue = (float)((double)event.blue * d0);
                                                    }
                                                }
                                            }
                                        

                                        Après tu peux très bien lancer ton jeu en débug et faire mumuse avec les valeurs ^^ (genre que multiplier le rouge, ou que le bleu, etc …)

                                        1 Reply Last reply Reply Quote 0
                                        • sosoh
                                          sosoh last edited by

                                          Ok merci, car j’avais trouvé qu’avec l’event “EntityViewRenderEvent.FogColors” ca marché mais comme on peut pas combiner 2 event ^^

                                          1 Reply Last reply Reply Quote 0
                                          • 1 / 1
                                          • First post
                                            Last post
                                          Design by Woryk
                                          Contact / Mentions Légales / Faire un don

                                          MINECRAFT FORGE FRANCE © 2018

                                          Powered by NodeBB