MFF

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

    [1.7.10] Créer une deuxième Barre D'Armure

    Planifier Épinglé Verrouillé Déplacé Non résolu Sans suite
    1.7.10
    14 Messages 3 Publieurs 1.2k Vues 3 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.
    • FayDownF Hors-ligne
      FayDown @robin4002
      dernière édition par

      Ce message a été supprimé !
      1 réponse Dernière réponse Répondre Citer 0
      • FayDownF Hors-ligne
        FayDown @robin4002
        dernière édition par FayDown

        @robin4002 Salut, j’ai tester comme de faire sa :

        if(event.type == RenderGameOverlayEvent.ElementType.ARMOR)
                {
                    Minecraft mc = Minecraft.getMinecraft();
                    event.setCanceled(true);
                    
                    float ard = mc.thePlayer.getTotalArmorValue();
                    String armore = EnumChatFormatting.AQUA + "Armure TEST" + EnumChatFormatting.BLUE + ard;
                    this.drawString(mc.fontRenderer, armore, 230, 290, 16777215);
                }
        

        Et la barre de nourriture est devenue Bleu enfin regarde le résultat.
        Mais à la place du String armor j’aimerais ajouter la texture de la barre d’armure pour la rajouter
        D’ailleurs voici le résultat que j’ai réussi à obtenir 🙂
        Résultat

        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

          Il faut réinitialiser la couleur après le draw avec un GL11.glColor3f(1.0F, 1.0F, 1.0F); sinon la dernière couleur utilisée reste.

          FayDownF 1 réponse Dernière réponse Répondre Citer 0
          • FayDownF Hors-ligne
            FayDown @robin4002
            dernière édition par FayDown

            @robin4002 Ok, mais je ne comprends pas où écrir ce que tu m’as dis de rajouter, et comment je peux faire pour récupérer la texture de l’armure pour rajouter ma deuxième Barre ? Ou alors comment ajouter une texture nouvelle (exemple : Bouclier, qui se remplit au fur et à mesure que l’armure est puissante) mais je préfère quand meme la première idée 🙂

                        this.drawString(mc.fontRenderer, armore, 230, 290, 16777215);
                        GL11.glColor3f(1.0F, 1.0F, 1.0F); //Ici ?
            
            
            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

              Oui ici pour le color3f

              Pour ajouter une texture il faut bind la ressource location contenant la texture et utiliser les fonctions de draw de la classe gui.

              FayDownF 1 réponse Dernière réponse Répondre Citer 0
              • FayDownF Hors-ligne
                FayDown @robin4002
                dernière édition par

                @robin4002 J’ai pas compris comment il fallait faire …
                Tu as surement bien expliqué mais je débute donc j’ai pas compris ce que tu as dis, tu pourrais-m’expliqué ?

                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

                  Je n’ai plus de workspace 1.7 sur mon pc depuis bien longtemps et je ne connais plus par coeur le nom de fonction donc je ne vais pas pouvoir te donner de code d’exemple.

                  Regardes dans la classe GuiIngame de Minecraft, localises où le rendu de l’armure est fait, c’est le même principe que tu dois réaliser.

                  FayDownF 2 réponses Dernière réponse Répondre Citer 0
                  • FayDownF Hors-ligne
                    FayDown @robin4002
                    dernière édition par

                    @robin4002 Ok mais je trouve pas le nom que cela porte, il me semble que c’est actionsbar mais je suis pas sûr.

                    if (!this.mc.playerController.enableEverythingIsScrewedUpMode())
                            {
                                GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
                                this.mc.getTextureManager().bindTexture(widgetsTexPath);
                                InventoryPlayer inventoryplayer = this.mc.thePlayer.inventory;
                                this.zLevel = -90.0F;
                                this.drawTexturedModalRect(k / 2 - 91, l - 22, 0, 0, 182, 22);
                                this.drawTexturedModalRect(k / 2 - 91 - 1 + inventoryplayer.currentItem * 20, l - 22 - 1, 0, 22, 24, 22);
                                this.mc.getTextureManager().bindTexture(icons);
                                GL11.glEnable(GL11.GL_BLEND);
                                OpenGlHelper.glBlendFunc(775, 769, 1, 0);
                                this.drawTexturedModalRect(k / 2 - 7, l / 2 - 7, 0, 0, 16, 16);
                                OpenGlHelper.glBlendFunc(770, 771, 1, 0);
                                this.mc.mcProfiler.startSection("bossHealth");
                                this.renderBossHealth();
                                this.mc.mcProfiler.endSection();
                    
                                if (this.mc.playerController.shouldDrawHUD())
                                {
                                    this.func_110327_a(k, l);
                                }
                    
                                this.mc.mcProfiler.startSection("actionBar");
                                GL11.glEnable(GL12.GL_RESCALE_NORMAL);
                                RenderHelper.enableGUIStandardItemLighting();
                    
                                for (i1 = 0; i1 < 9; ++i1)
                                {
                                    j1 = k / 2 - 90 + i1 * 20 + 2;
                                    k1 = l - 16 - 3;
                                    this.renderInventorySlot(i1, j1, k1, p_73830_1_);
                                }
                    
                                RenderHelper.disableStandardItemLighting();
                                GL11.glDisable(GL12.GL_RESCALE_NORMAL);
                                this.mc.mcProfiler.endSection();
                                GL11.glDisable(GL11.GL_BLEND);
                            }
                    
                            int l4;
                    
                            if (this.mc.thePlayer.getSleepTimer() > 0)
                            {
                                this.mc.mcProfiler.startSection("sleep");
                                GL11.glDisable(GL11.GL_DEPTH_TEST);
                                GL11.glDisable(GL11.GL_ALPHA_TEST);
                                l4 = this.mc.thePlayer.getSleepTimer();
                                float f2 = (float)l4 / 100.0F;
                    
                                if (f2 > 1.0F)
                                {
                                    f2 = 1.0F - (float)(l4 - 100) / 10.0F;
                                }
                    
                                j1 = (int)(220.0F * f2) << 24 | 1052704;
                                drawRect(0, 0, k, l, j1);
                                GL11.glEnable(GL11.GL_ALPHA_TEST);
                                GL11.glEnable(GL11.GL_DEPTH_TEST);
                                this.mc.mcProfiler.endSection();
                            }
                    
                            l4 = 16777215;
                            GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
                            i1 = k / 2 - 91;
                            int l1;
                            int i2;
                            int j2;
                            int k2;
                            float f3;
                            short short1;
                    
                            if (this.mc.thePlayer.isRidingHorse())
                            {
                                this.mc.mcProfiler.startSection("jumpBar");
                                this.mc.getTextureManager().bindTexture(Gui.icons);
                                f3 = this.mc.thePlayer.getHorseJumpPower();
                                short1 = 182;
                                l1 = (int)(f3 * (float)(short1 + 1));
                                i2 = l - 32 + 3;
                                this.drawTexturedModalRect(i1, i2, 0, 84, short1, 5);
                    
                                if (l1 > 0)
                                {
                                    this.drawTexturedModalRect(i1, i2, 0, 89, l1, 5);
                                }
                    
                                this.mc.mcProfiler.endSection();
                            }
                            else if (this.mc.playerController.gameIsSurvivalOrAdventure())
                            {
                                this.mc.mcProfiler.startSection("expBar");
                                this.mc.getTextureManager().bindTexture(Gui.icons);
                                j1 = this.mc.thePlayer.xpBarCap();
                    
                                if (j1 > 0)
                                {
                                    short1 = 182;
                                    l1 = (int)(this.mc.thePlayer.experience * (float)(short1 + 1));
                                    i2 = l - 32 + 3;
                                    this.drawTexturedModalRect(i1, i2, 0, 64, short1, 5);
                    
                                    if (l1 > 0)
                                    {
                                        this.drawTexturedModalRect(i1, i2, 0, 69, l1, 5);
                                    }
                                }
                    
                                this.mc.mcProfiler.endSection();
                    
                                if (this.mc.thePlayer.experienceLevel > 0)
                                {
                                    this.mc.mcProfiler.startSection("expLevel");
                                    boolean flag2 = false;
                                    l1 = flag2 ? 16777215 : 8453920;
                                    String s3 = "" + this.mc.thePlayer.experienceLevel;
                                    j2 = (k - fontrenderer.getStringWidth(s3)) / 2;
                                    k2 = l - 31 - 4;
                                    boolean flag1 = false;
                                    fontrenderer.drawString(s3, j2 + 1, k2, 0);
                                    fontrenderer.drawString(s3, j2 - 1, k2, 0);
                                    fontrenderer.drawString(s3, j2, k2 + 1, 0);
                                    fontrenderer.drawString(s3, j2, k2 - 1, 0);
                                    fontrenderer.drawString(s3, j2, k2, l1);
                                    this.mc.mcProfiler.endSection();
                                }
                            }
                    
                            String s2;
                    
                            if (this.mc.gameSettings.heldItemTooltips)
                            {
                                this.mc.mcProfiler.startSection("toolHighlight");
                    
                                if (this.remainingHighlightTicks > 0 && this.highlightingItemStack != null)
                                {
                                    s2 = this.highlightingItemStack.getDisplayName();
                                    k1 = (k - fontrenderer.getStringWidth(s2)) / 2;
                                    l1 = l - 59;
                    
                                    if (!this.mc.playerController.shouldDrawHUD())
                                    {
                                        l1 += 14;
                                    }
                    
                                    i2 = (int)((float)this.remainingHighlightTicks * 256.0F / 10.0F);
                    
                                    if (i2 > 255)
                                    {
                                        i2 = 255;
                                    }
                    
                                    if (i2 > 0)
                                    {
                                        GL11.glPushMatrix();
                                        GL11.glEnable(GL11.GL_BLEND);
                                        OpenGlHelper.glBlendFunc(770, 771, 1, 0);
                                        fontrenderer.drawStringWithShadow(s2, k1, l1, 16777215 + (i2 << 24));
                                        GL11.glDisable(GL11.GL_BLEND);
                                        GL11.glPopMatrix();
                                    }
                                }
                    
                                this.mc.mcProfiler.endSection();
                            }
                    
                    1 réponse Dernière réponse Répondre Citer 0
                    • FayDownF Hors-ligne
                      FayDown @robin4002
                      dernière édition par

                      @robin4002 Dailleurs il faut que je lui donne la priorité dans le proxy client normalement non ?

                      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

                        Je n’ai pas l’impression que l’armure soit dans la partie que tu as envoyée.
                        On voit par contre la barre d’xp, la barre des items et le rendu de la vie des bosses.

                        Je ne vois pas de quelle priorité tu parles.

                        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