MFF

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

    Ajouter un bouton à un GUI

    Planifier Épinglé Verrouillé Déplacé Résolu 1.7.x
    1.7.10
    63 Messages 6 Publieurs 14.0k 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.
    • robin4002R Hors-ligne
      robin4002 Moddeurs confirmés Rédacteurs Administrateurs
      dernière édition par

      Non, pas sur mes projets publics.

      1 réponse Dernière réponse Répondre Citer 0
      • Benjamin LoisonB Hors-ligne
        Benjamin Loison
        dernière édition par

        😞 Quelqu’un d’autre a de l’aide à apporter ?

        >! Développeur de Altis-Life (Arma III) sur Minecraft !
        >! Site web     : https://lemnoslife.com

        1 réponse Dernière réponse Répondre Citer 0
        • DiabolicaTrixD Hors-ligne
          DiabolicaTrix Correcteurs Moddeurs confirmés
          dernière édition par

          Perso, j’utilise ça:

          package diabolicatrix.base;
          
          import org.lwjgl.opengl.GL11;
          
          import ibxm.Player;
          import net.minecraft.client.Minecraft;
          import net.minecraft.client.gui.GuiButton;
          import net.minecraft.client.gui.GuiLabel;
          import net.minecraft.client.gui.GuiScreen;
          import net.minecraft.util.ResourceLocation;
          
          public class GuiMouseOver extends GuiScreen {
          
          int guiWidth = 114;
          int guiHeight = 44;
          GuiButton tradeButton;
          String label = "player";
          
          public void drawScreen(int x, int y, float tick) {
          int guiX = (this.width - guiWidth) / 2;
          int guiY = (this.height - guiHeight) / 2;
          GL11.glColor4f(1, 1, 1, 1);
          drawDefaultBackground();
          mc.renderEngine.bindTexture(new ResourceLocation("t4:textures/gui/guiotherplayer.png"));
          drawTexturedModalRect(guiX, guiY, 0, 0, guiWidth, guiHeight);
          fontRendererObj.drawString("Player Menu", (int) (guiX + 25), guiY + 6, 0x000000);
          super.drawScreen(x, y, tick);
          }
          
          @Override
          public void initGui()
          {
          int guiX = (this.width - guiWidth) / 2;
          int guiY = (this.height - guiHeight) / 2;
          buttonList.clear();
          buttonList.add(new GuiButton(0, guiX + 8, guiY + 12 + 5, 98, 20, label));
          super.initGui();
          }
          
          @Override
          protected void actionPerformed(GuiButton btn)
          {
          switch(btn.id){
          case 0:
          System.out.println("Trade!");
          }
          }
          }
          

          et ça donne ça:

          1 réponse Dernière réponse Répondre Citer 0
          • Benjamin LoisonB Hors-ligne
            Benjamin Loison
            dernière édition par

            C’est bon merci à toi et sinon pour mon bouton orange je fais comment ?

            SCAREX avec ta technique,

            ​package fr.altiscraft.altiscraft.common;
            
            import org.lwjgl.opengl.GL11;
            
            import net.minecraft.client.gui.FontRenderer;
            import net.minecraft.client.gui.GuiButton;
            import net.minecraft.client.gui.GuiScreen;
            import net.minecraft.client.gui.GuiTextField;
            import net.minecraft.util.ResourceLocation;
            
            public class GuiATM extends GuiScreen {
            
            int guiWidth = 140;
            int guiHeight = 220;
            GuiButton tradeButton;
            String label = "RETIRER";
            String labele = "DEPOSER";
            String labelee = "TRANSFERER";
            String labeleee = "DEPOSER POUR LE GANG";
            String labeleeee = "FERMER";
            
            private GuiTextField textfield;
            private GuiTextField textefield;
            
            public void drawScreen(int x, int y, float tick) {
            int guiX = (this.width - guiWidth) / 2;
            int guiY = (this.height - guiHeight) / 2;
            GL11.glColor4f(1, 1, 1, 1);
            mc.renderEngine.bindTexture(new ResourceLocation(ModAltisCraft.MODID, "textures/gui/Fond.png"));
            drawTexturedModalRect(guiX, guiY, 0, 0, guiWidth, guiHeight);
            fontRendererObj.drawString("Gestion du Compte Bancaire", guiX + 2, guiY + 5, 0xFFFFFF);
            fontRendererObj.drawString("654 346 €", guiX + 45, guiY + 25, 0xFFFFFF);
            fontRendererObj.drawString("21 838 €", guiX + 45, guiY + 42, 0xFFFFFF);
            this.textfield.drawTextBox();
            this.textefield.drawTextBox();
            super.drawScreen(x, y, tick);
            }
            
            @Override
            public void initGui() {
            int guiX = (this.width - guiWidth) / 2;
            int guiY = (this.height - guiHeight) / 2;
            buttonList.clear();
            buttonList.add(new GuiButton(0, guiX + 20, guiY + 72 + 5, 98, 20, label));
            GL11.glColor4f(255, 255, 255, 255);
            buttonList.add(new GuiButton(1, guiX + 20, guiY + 95 + 5, 98, 20, labele));
            buttonList.add(new GuiButton(2, guiX + 20, guiY + 138 + 5, 98, 20, labelee));
            buttonList.add(new GuiButton(3, guiX + 5, guiY + 165 + 5, 130, 20, labeleee));
            buttonList.add(new GuiButton(4, guiX + 5, guiY + 190 + 5, 50, 20, labeleeee));
            this.textfield = new GuiTextField(this.fontRendererObj, this.width / 2 - 50, this.height / 2 - 55, 98, 20);
            textfield.setMaxStringLength(12);
            textfield.setText("");
            ((GuiTextField) this.textfield).setFocused(true);
            this.textefield = new GuiTextField(this.fontRendererObj, this.width / 2 - 50, this.height / 2 + 12, 98, 20);
            textefield.setMaxStringLength(20);
            textefield.setText("");
            ((GuiTextField) this.textefield).setFocused(true);
            super.initGui();
            }
            
            protected void keyTyped(char par1, int par2) {
            super.keyTyped(par1, par2);
            this.textfield.textboxKeyTyped(par1, par2);
            this.textefield.textboxKeyTyped(par1, par2);
            }
            
            protected void mouseClicked(int x, int y, int btn) {
            super.mouseClicked(x, y, btn);
            this.textfield.mouseClicked(x, y, btn);
            this.textefield.mouseClicked(x, y, btn);
            }
            
            @Override
            protected void actionPerformed(GuiButton btn) {
            switch (btn.id) {
            case 0:
            System.out.println("Trade !");
            }
            }
            }
            

            et ça donne ce crash-report : http://pastebin.com/yuG0BG6A

            EDIT : et pour robin j’ai fais ça :

            ​package fr.altiscraft.altiscraft.common;
            
            import org.lwjgl.opengl.GL11;
            
            import net.minecraft.client.gui.FontRenderer;
            import net.minecraft.client.gui.GuiButton;
            import net.minecraft.client.gui.GuiScreen;
            import net.minecraft.client.gui.GuiTextField;
            import net.minecraft.util.ResourceLocation;
            
            public class GuiATM extends GuiScreen {
            
            int guiWidth = 140;
            int guiHeight = 220;
            GuiButton tradeButton;
            String label = "RETIRER";
            String labele = "DEPOSER";
            String labelee = "TRANSFERER";
            String labeleee = "DEPOSER POUR LE GANG";
            String labeleeee = "FERMER";
            
            private GuiTextField textfield;
            private GuiTextField textefield;
            
            public void drawScreen(int x, int y, float tick) {
            int guiX = (this.width - guiWidth) / 2;
            int guiY = (this.height - guiHeight) / 2;
            GL11.glColor4f(1, 1, 1, 1);
            mc.renderEngine.bindTexture(new ResourceLocation(ModAltisCraft.MODID, "textures/gui/Fond.png"));
            drawTexturedModalRect(guiX, guiY, 0, 0, guiWidth, guiHeight);
            fontRendererObj.drawString("Gestion du Compte Bancaire", guiX + 2, guiY + 5, 0xFFFFFF);
            fontRendererObj.drawString("654 346 €", guiX + 45, guiY + 25, 0xFFFFFF);
            fontRendererObj.drawString("21 838 €", guiX + 45, guiY + 42, 0xFFFFFF);
            this.textfield.drawTextBox();
            this.textefield.drawTextBox();
            super.drawScreen(x, y, tick);
            }
            
            @Override
            public void initGui() {
            int guiX = (this.width - guiWidth) / 2;
            int guiY = (this.height - guiHeight) / 2;
            buttonList.clear();
            buttonList.add(new GuiButton(0, guiX + 20, guiY + 72 + 5, 98, 20, label));
            mc.renderEngine.bindTexture(new ResourceLocation(ModAltisCraft.MODID, "textures/gui/widgets.png"));
            buttonList.add(new GuiButton(1, guiX + 20, guiY + 95 + 5, 98, 20, labele));
            buttonList.add(new GuiButton(2, guiX + 20, guiY + 138 + 5, 98, 20, labelee));
            buttonList.add(new GuiButton(3, guiX + 5, guiY + 165 + 5, 130, 20, labeleee));
            buttonList.add(new GuiButton(4, guiX + 5, guiY + 190 + 5, 50, 20, labeleeee));
            this.textfield = new GuiTextField(this.fontRendererObj, this.width / 2 - 50, this.height / 2 - 55, 98, 20);
            textfield.setMaxStringLength(12);
            textfield.setText("");
            ((GuiTextField) this.textfield).setFocused(true);
            this.textefield = new GuiTextField(this.fontRendererObj, this.width / 2 - 50, this.height / 2 + 12, 98, 20);
            textefield.setMaxStringLength(20);
            textefield.setText("");
            ((GuiTextField) this.textefield).setFocused(true);
            super.initGui();
            }
            
            protected void keyTyped(char par1, int par2) {
            super.keyTyped(par1, par2);
            this.textfield.textboxKeyTyped(par1, par2);
            this.textefield.textboxKeyTyped(par1, par2);
            }
            
            protected void mouseClicked(int x, int y, int btn) {
            super.mouseClicked(x, y, btn);
            this.textfield.mouseClicked(x, y, btn);
            this.textefield.mouseClicked(x, y, btn);
            }
            
            @Override
            protected void actionPerformed(GuiButton btn) {
            switch (btn.id) {
            case 0:
            System.out.println("Trade !");
            }
            }
            }
            

            mais j’ai ça : http://pastebin.com/u63yRzCt

            >! Développeur de Altis-Life (Arma III) sur Minecraft !
            >! Site web     : https://lemnoslife.com

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

              GL11.glColor4f utilise des float, et non des couleurs sur une base 256 mais sur 1. Si tu veux seulement colorier le bouton, tu ne dois pas le mettre dans la méthode du GUI mais dans celle du bouton. Tu as un NPE : vérifie que tes variables soient initialisés correctement, et donne leur un meilleur nom.

              PS : penses aux fichiers de traduction pour tes textes.

              Site web contenant mes scripts : http://SCAREXgaming.github.io

              Pas de demandes de support par MP ni par skype SVP.
              Je n'accepte sur skype que l…

              1 réponse Dernière réponse Répondre Citer 0
              • Benjamin LoisonB Hors-ligne
                Benjamin Loison
                dernière édition par

                ​package fr.altiscraft.altiscraft.common;
                
                import org.lwjgl.opengl.GL11;
                
                import net.minecraft.client.gui.FontRenderer;
                import net.minecraft.client.gui.GuiButton;
                import net.minecraft.client.gui.GuiScreen;
                import net.minecraft.client.gui.GuiTextField;
                import net.minecraft.util.ResourceLocation;
                
                public class GuiATM extends GuiScreen {
                
                int guiWidth = 140;
                int guiHeight = 220;
                GuiButton tradeButton;
                String label = "RETIRER";
                String labele = "DEPOSER";
                String labelee = "TRANSFERER";
                String labeleee = "DEPOSER POUR LE GANG";
                String labeleeee = "FERMER";
                
                private GuiTextField textfield;
                private GuiTextField textefield;
                
                public void drawScreen(int x, int y, float tick) {
                int guiX = (this.width - guiWidth) / 2;
                int guiY = (this.height - guiHeight) / 2;
                GL11.glColor4f(1, 1, 1, 1);
                mc.renderEngine.bindTexture(new ResourceLocation(ModAltisCraft.MODID, "textures/gui/Fond.png"));
                drawTexturedModalRect(guiX, guiY, 0, 0, guiWidth, guiHeight);
                fontRendererObj.drawString("Gestion du Compte Bancaire", guiX + 2, guiY + 5, 0xFFFFFF);
                fontRendererObj.drawString("654 346 €", guiX + 45, guiY + 25, 0xFFFFFF);
                fontRendererObj.drawString("21 838 €", guiX + 45, guiY + 42, 0xFFFFFF);
                this.textfield.drawTextBox();
                this.textefield.drawTextBox();
                super.drawScreen(x, y, tick);
                }
                
                @Override
                public void initGui() {
                int guiX = (this.width - guiWidth) / 2;
                int guiY = (this.height - guiHeight) / 2;
                buttonList.clear();
                buttonList.add(new GuiAC(0, guiX + 20, guiY + 72 + 5, 98, 20, label));
                buttonList.add(new GuiButton(1, guiX + 20, guiY + 95 + 5, 98, 20, labele));
                buttonList.add(new GuiButton(2, guiX + 20, guiY + 138 + 5, 98, 20, labelee));
                buttonList.add(new GuiButton(3, guiX + 5, guiY + 165 + 5, 130, 20, labeleee));
                buttonList.add(new GuiButton(4, guiX + 5, guiY + 190 + 5, 50, 20, labeleeee));
                this.textfield = new GuiTextField(this.fontRendererObj, this.width / 2 - 50, this.height / 2 - 55, 98, 20);
                textfield.setMaxStringLength(12);
                textfield.setText("");
                ((GuiTextField) this.textfield).setFocused(true);
                this.textefield = new GuiTextField(this.fontRendererObj, this.width / 2 - 50, this.height / 2 + 12, 98, 20);
                textefield.setMaxStringLength(20);
                textefield.setText("");
                ((GuiTextField) this.textefield).setFocused(true);
                super.initGui();
                }
                
                protected void keyTyped(char par1, int par2) {
                super.keyTyped(par1, par2);
                this.textfield.textboxKeyTyped(par1, par2);
                this.textefield.textboxKeyTyped(par1, par2);
                }
                
                protected void mouseClicked(int x, int y, int btn) {
                super.mouseClicked(x, y, btn);
                this.textfield.mouseClicked(x, y, btn);
                this.textefield.mouseClicked(x, y, btn);
                }
                
                @Override
                protected void actionPerformed(GuiButton btn) {
                switch (btn.id) {
                case 0:
                System.out.println("Trade !");
                }
                }
                }
                

                Voilà et avec le premier bouton ne marche pas avec cette classe :

                ​package fr.altiscraft.altiscraft.common;
                
                import org.lwjgl.opengl.GL11;
                
                import cpw.mods.fml.relauncher.Side;
                import cpw.mods.fml.relauncher.SideOnly;
                import net.minecraft.client.Minecraft;
                import net.minecraft.client.audio.PositionedSoundRecord;
                import net.minecraft.client.audio.SoundHandler;
                import net.minecraft.client.gui.FontRenderer;
                import net.minecraft.client.gui.Gui;
                import net.minecraft.client.renderer.OpenGlHelper;
                import net.minecraft.util.ResourceLocation;
                
                @SideOnly(Side.CLIENT)
                public class GuiAC extends Gui
                {
                    protected static final ResourceLocation buttonTextures = new ResourceLocation(ModAltisCraft.MODID, "textures/gui/widgets.png");
                    /** Button width in pixels */
                    public int width;
                    /** Button height in pixels */
                    public int height;
                    /** The x position of this control. */
                    public int xPosition;
                    /** The y position of this control. */
                    public int yPosition;
                    /** The string displayed on this control. */
                    public String displayString;
                    public int id;
                    /** True if this control is enabled, false to disable. */
                    public boolean enabled;
                    /** Hides the button completely if false. */
                    public boolean visible;
                    protected boolean field_146123_n;
                    private static final String __OBFID = "CL_00000668";
                    public int packedFGColour;
                
                    public GuiAC(int p_i1020_1_, int p_i1020_2_, int p_i1020_3_, String p_i1020_4_)
                    {
                        this(p_i1020_1_, p_i1020_2_, p_i1020_3_, 200, 20, p_i1020_4_);
                    }
                
                    public GuiAC(int p_i1021_1_, int p_i1021_2_, int p_i1021_3_, int p_i1021_4_, int p_i1021_5_, String p_i1021_6_)
                    {
                        this.width = 200;
                        this.height = 20;
                        this.enabled = true;
                        this.visible = true;
                        this.id = p_i1021_1_;
                        this.xPosition = p_i1021_2_;
                        this.yPosition = p_i1021_3_;
                        this.width = p_i1021_4_;
                        this.height = p_i1021_5_;
                        this.displayString = p_i1021_6_;
                    }
                
                    /**
                     * Returns 0 if the button is disabled, 1 if the mouse is NOT hovering over this button and 2 if it IS hovering over
                     * this button.
                     */
                    public int getHoverState(boolean p_146114_1_)
                    {
                        byte b0 = 1;
                
                        if (!this.enabled)
                        {
                            b0 = 0;
                        }
                        else if (p_146114_1_)
                        {
                            b0 = 2;
                        }
                
                        return b0;
                    }
                
                    /**
                     * Draws this button to the screen.
                     */
                    public void drawButton(Minecraft p_146112_1_, int p_146112_2_, int p_146112_3_)
                    {
                        if (this.visible)
                        {
                            FontRenderer fontrenderer = p_146112_1_.fontRenderer;
                            p_146112_1_.getTextureManager().bindTexture(buttonTextures);
                            GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
                            this.field_146123_n = p_146112_2_ >= this.xPosition && p_146112_3_ >= this.yPosition && p_146112_2_ < this.xPosition + this.width && p_146112_3_ < this.yPosition + this.height;
                            int k = this.getHoverState(this.field_146123_n);
                            GL11.glEnable(GL11.GL_BLEND);
                            OpenGlHelper.glBlendFunc(770, 771, 1, 0);
                            GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
                            this.drawTexturedModalRect(this.xPosition, this.yPosition, 0, 46 + k * 20, this.width / 2, this.height);
                            this.drawTexturedModalRect(this.xPosition + this.width / 2, this.yPosition, 200 - this.width / 2, 46 + k * 20, this.width / 2, this.height);
                            this.mouseDragged(p_146112_1_, p_146112_2_, p_146112_3_);
                            int l = 14737632;
                
                            if (packedFGColour != 0)
                            {
                                l = packedFGColour;
                            }
                            else if (!this.enabled)
                            {
                                l = 10526880;
                            }
                            else if (this.field_146123_n)
                            {
                                l = 16777120;
                            }
                
                            this.drawCenteredString(fontrenderer, this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - 8) / 2, l);
                        }
                    }
                
                    /**
                     * Fired when the mouse button is dragged. Equivalent of MouseListener.mouseDragged(MouseEvent e).
                     */
                    protected void mouseDragged(Minecraft p_146119_1_, int p_146119_2_, int p_146119_3_) {}
                
                    /**
                     * Fired when the mouse button is released. Equivalent of MouseListener.mouseReleased(MouseEvent e).
                     */
                    public void mouseReleased(int p_146118_1_, int p_146118_2_) {}
                
                    /**
                     * Returns true if the mouse has been pressed on this control. Equivalent of MouseListener.mousePressed(MouseEvent
                     * e).
                     */
                    public boolean mousePressed(Minecraft p_146116_1_, int p_146116_2_, int p_146116_3_)
                    {
                        return this.enabled && this.visible && p_146116_2_ >= this.xPosition && p_146116_3_ >= this.yPosition && p_146116_2_ < this.xPosition + this.width && p_146116_3_ < this.yPosition + this.height;
                    }
                
                    public boolean func_146115_a()
                    {
                        return this.field_146123_n;
                    }
                
                    public void func_146111_b(int p_146111_1_, int p_146111_2_) {}
                
                    public void func_146113_a(SoundHandler p_146113_1_)
                    {
                        p_146113_1_.playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
                    }
                
                    public int getButtonWidth()
                    {
                        return this.width;
                    }
                
                    public int func_154310_c()
                    {
                        return this.height;
                    }
                }
                

                et ça me donne ça : http://pastebin.com/kLPDd6QP

                et je ne comprends pas comment faire un système de couleur sur 1 sur 3 nombre 😕 ?

                et comment veut tu que je la mettes dans la méthode du bouton sachant qu’elle est vérouilllé comme ça en est une de Minecraft

                >! Développeur de Altis-Life (Arma III) sur Minecraft !
                >! Site web     : https://lemnoslife.com

                1 réponse Dernière réponse Répondre Citer 0
                • DiabolicaTrixD Hors-ligne
                  DiabolicaTrix Correcteurs Moddeurs confirmés
                  dernière édition par

                  fontRendererObj.drawString("654 346 €", guiX + 45, guiY + 25, 0xFFFFFF);
                  
                  
                  fontRendererObj.drawString("21 838 €", guiX + 45, guiY + 42, 0xFFFFFF);
                  

                  Tu devrais prévoir des variables pour les montants mais bon, aucun rapport avec ton problème

                  Ex.:

                  fontRendererObj.drawString(mavariable + "€", guiX + 45, guiY + 25, 0xFFFFFF);
                  

                  [size=x-smallbuttonList][size=x-small.][size=x-smalladd][size=x-small(][size=x-smallnew] [size=x-smallGuiAC][size=x-small(][size=x-small0][size=x-small,][size=x-small guiX ][size=x-small+] [size=x-small20][size=x-small,][size=x-small guiY ][size=x-small+] [size=x-small72] [size=x-small+] [size=x-small5][size=x-small,] [size=x-small98][size=x-small,] [size=x-small20][size=x-small,][size=x-small label][size=x-small));]

                  Le GuiAC() c’est une de tes classe? et c’est le premier bouton donc c’est lui qui ne fonctionne pas? si oui envois ta classe.

                  1 réponse Dernière réponse Répondre Citer 0
                  • Benjamin LoisonB Hors-ligne
                    Benjamin Loison
                    dernière édition par

                    Oui je comptais le faire merci beaucoup mais c’était rien que déjà pour titre d’exemple 🙂

                    >! Développeur de Altis-Life (Arma III) sur Minecraft !
                    >! Site web     : https://lemnoslife.com

                    1 réponse Dernière réponse Répondre Citer 0
                    • DiabolicaTrixD Hors-ligne
                      DiabolicaTrix Correcteurs Moddeurs confirmés
                      dernière édition par

                      PS: j’ai edit le message:

                      [size=smallLe GuiAC() c’est une de tes classe? et c’est le premier bouton donc c’est lui qui ne fonctionne pas? si oui envois ta classe.]

                      1 réponse Dernière réponse Répondre Citer 0
                      • Benjamin LoisonB Hors-ligne
                        Benjamin Loison
                        dernière édition par

                        J’ai déjà tout envoyé et oui

                        PS: vraiment merci de ton aide bro’ 🙂

                        >! Développeur de Altis-Life (Arma III) sur Minecraft !
                        >! Site web     : https://lemnoslife.com

                        1 réponse Dernière réponse Répondre Citer 0
                        • DiabolicaTrixD Hors-ligne
                          DiabolicaTrix Correcteurs Moddeurs confirmés
                          dernière édition par

                          Attend, pourquoi tu ne bind pas tout simplement une autre texture au bouton?

                          Pour le crash, désolé, je ne peux pas t’aider mais selon cette ligne:

                          1. java.lang.ClassCastException: fr.altiscraft.altiscraft.common.GuiAC cannot be cast to net.minecraft.client.gui.GuiButton

                          Ta class GuiAC a un “résidu” de GuiButton dans le sens où tu as copier coller la classe et tu as oublier de modifier quelque chose qui a rapport avec GuiButton. Bon, je dis surement de la merde mais bon.

                          PS: Ça fait plaisir 😉

                          PPS: Retire:

                          ​%(#000000)[[size=x-small]  ]%(#7f0055)[[size=x-small]**private**] %(#7f0055)[[size=x-small]**static**] %(#7f0055)[[size=x-small]**final**] %(#000000)[[size=x-small]String]%(#000000)[[size=x-small] __OBFID ]%(#666600)[[size=x-small]=] %(#2a00ff)[[size=x-small]"CL_00000668"]%(#666600)[[size=x-small];]
                          

                          C’est pour l’obfuscation, tu n’en as pas besoin.

                          1 réponse Dernière réponse Répondre Citer 0
                          • Benjamin LoisonB Hors-ligne
                            Benjamin Loison
                            dernière édition par

                            Tu dois avoir raison mais je ne sais pas trop et regarde tout en haut ma réponse à robin 😕

                            >! Développeur de Altis-Life (Arma III) sur Minecraft !
                            >! Site web     : https://lemnoslife.com

                            1 réponse Dernière réponse Répondre Citer 0
                            • DiabolicaTrixD Hors-ligne
                              DiabolicaTrix Correcteurs Moddeurs confirmés
                              dernière édition par

                              Je ne vois pas ta réponse à robin… à Scarex tu veux dire?

                              1 réponse Dernière réponse Répondre Citer 0
                              • Benjamin LoisonB Hors-ligne
                                Benjamin Loison
                                dernière édition par

                                Le #24

                                >! Développeur de Altis-Life (Arma III) sur Minecraft !
                                >! Site web     : https://lemnoslife.com

                                1 réponse Dernière réponse Répondre Citer 0
                                • DiabolicaTrixD Hors-ligne
                                  DiabolicaTrix Correcteurs Moddeurs confirmés
                                  dernière édition par

                                  Ah ouais j’avais vu et j’ai lu le crash report mais je ne peux pas t’aider, désolé :s

                                  1 réponse Dernière réponse Répondre Citer 0
                                  • Benjamin LoisonB Hors-ligne
                                    Benjamin Loison
                                    dernière édition par

                                    Pas grave merci beaucoup déjà sinon j’aimerais dans mon case 4 j’aimerais faire que ça ferme le GUI ça parait simple mais je ne trouve pas le code nécessaire une idée ? ^^ et j’aimerais passer par un système de packet comme tu as pu le comprendre pour mon GUI d’ATM pour afficher l’argent mais c’est assez compliqué en plus que je voudrais créer une autre “banque” (stockage d’argent virtuel, pas en item) enfin bon au faite tu as Skype ou TeamSpeak maintenant ?

                                    >! Développeur de Altis-Life (Arma III) sur Minecraft !
                                    >! Site web     : https://lemnoslife.com

                                    1 réponse Dernière réponse Répondre Citer 0
                                    • DiabolicaTrixD Hors-ligne
                                      DiabolicaTrix Correcteurs Moddeurs confirmés
                                      dernière édition par

                                      Pour fermer le Gui normalement c’est Minecraft.getMinecraft().displayGuiScreen(null);

                                      Pour les packets: http://www.minecraftforgefrance.fr/showthread.php?tid=1118

                                      Et oui, j’ai les deux.

                                      PS: Windows 10 n’est pas encore installé j’attend les 165 majs windows update et après je l’installe

                                      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

                                        http://minecraftforgefrance.fr/showthread.php?tid=2447&pid=28442#pid28442
                                        -> tes variables textfield et textefield sont null lors du premier drawScreen (qui est visiblement appelé avant initGui. Ajoutes un null check.

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

                                          Ton bouton n’est pas extends GuiButton… C’est tout simplement marqué dans le crash report.

                                          Regarde le tutoriel sur les Extended Entity Properties, y’a un exemple de banque.

                                          Site web contenant mes scripts : http://SCAREXgaming.github.io

                                          Pas de demandes de support par MP ni par skype SVP.
                                          Je n'accepte sur skype que l…

                                          1 réponse Dernière réponse Répondre Citer 0
                                          • Benjamin LoisonB Hors-ligne
                                            Benjamin Loison
                                            dernière édition par

                                            Merci et j’ai changé par un GuiButton mais regardes il y a une erreur au 2ème public GuiAC(…)
                                            Implicit super constructor GuiButton() is undefined. Must explicity invoke another constructor

                                            ​package fr.altiscraft.altiscraft.common;
                                            
                                            import org.lwjgl.opengl.GL11;
                                            
                                            import cpw.mods.fml.relauncher.Side;
                                            import cpw.mods.fml.relauncher.SideOnly;
                                            import net.minecraft.client.Minecraft;
                                            import net.minecraft.client.audio.PositionedSoundRecord;
                                            import net.minecraft.client.audio.SoundHandler;
                                            import net.minecraft.client.gui.FontRenderer;
                                            import net.minecraft.client.gui.GuiButton;
                                            import net.minecraft.client.renderer.OpenGlHelper;
                                            import net.minecraft.util.ResourceLocation;
                                            
                                            @SideOnly(Side.CLIENT)
                                            public class GuiAC extends GuiButton {
                                            protected static final ResourceLocation buttonTextures = new ResourceLocation(ModAltisCraft.MODID,
                                            "textures/gui/widgets.png");
                                            /** Button width in pixels */
                                            public int width;
                                            /** Button height in pixels */
                                            public int height;
                                            /** The x position of this control. */
                                            public int xPosition;
                                            /** The y position of this control. */
                                            public int yPosition;
                                            /** The string displayed on this control. */
                                            public String displayString;
                                            public int id;
                                            /** True if this control is enabled, false to disable. */
                                            public boolean enabled;
                                            /** Hides the button completely if false. */
                                            public boolean visible;
                                            protected boolean field_146123_n;
                                            public int packedFGColour;
                                            
                                            public GuiAC(int p_i1020_1_, int p_i1020_2_, int p_i1020_3_, String p_i1020_4_) {
                                            this(p_i1020_1_, p_i1020_2_, p_i1020_3_, 200, 20, p_i1020_4_);
                                            }
                                            
                                            public GuiAC(int p_i1021_1_, int p_i1021_2_, int p_i1021_3_, int p_i1021_4_, int p_i1021_5_, String p_i1021_6_) {
                                            this.width = 200;
                                            this.height = 20;
                                            this.enabled = true;
                                            this.visible = true;
                                            this.id = p_i1021_1_;
                                            this.xPosition = p_i1021_2_;
                                            this.yPosition = p_i1021_3_;
                                            this.width = p_i1021_4_;
                                            this.height = p_i1021_5_;
                                            this.displayString = p_i1021_6_;
                                            }
                                            
                                            /**
                                            * Returns 0 if the button is disabled, 1 if the mouse is NOT hovering over
                                            * this button and 2 if it IS hovering over this button.
                                            */
                                            public int getHoverState(boolean p_146114_1_) {
                                            byte b0 = 1;
                                            
                                            if (!this.enabled) {
                                            b0 = 0;
                                            } else if (p_146114_1_) {
                                            b0 = 2;
                                            }
                                            
                                            return b0;
                                            }
                                            
                                            /**
                                            * Draws this button to the screen.
                                            */
                                            public void drawButton(Minecraft p_146112_1_, int p_146112_2_, int p_146112_3_) {
                                            if (this.visible) {
                                            FontRenderer fontrenderer = p_146112_1_.fontRenderer;
                                            p_146112_1_.getTextureManager().bindTexture(buttonTextures);
                                            GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
                                            this.field_146123_n = p_146112_2_ >= this.xPosition && p_146112_3_ >= this.yPosition
                                            && p_146112_2_ < this.xPosition + this.width && p_146112_3_ < this.yPosition + this.height;
                                            int k = this.getHoverState(this.field_146123_n);
                                            GL11.glEnable(GL11.GL_BLEND);
                                            OpenGlHelper.glBlendFunc(770, 771, 1, 0);
                                            GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
                                            this.drawTexturedModalRect(this.xPosition, this.yPosition, 0, 46 + k * 20, this.width / 2, this.height);
                                            this.drawTexturedModalRect(this.xPosition + this.width / 2, this.yPosition, 200 - this.width / 2,
                                            46 + k * 20, this.width / 2, this.height);
                                            this.mouseDragged(p_146112_1_, p_146112_2_, p_146112_3_);
                                            int l = 14737632;
                                            
                                            if (packedFGColour != 0) {
                                            l = packedFGColour;
                                            } else if (!this.enabled) {
                                            l = 10526880;
                                            } else if (this.field_146123_n) {
                                            l = 16777120;
                                            }
                                            
                                            this.drawCenteredString(fontrenderer, this.displayString, this.xPosition + this.width / 2,
                                            this.yPosition + (this.height - 8) / 2, l);
                                            }
                                            }
                                            
                                            /**
                                            * Fired when the mouse button is dragged. Equivalent of
                                            * MouseListener.mouseDragged(MouseEvent e).
                                            */
                                            protected void mouseDragged(Minecraft p_146119_1_, int p_146119_2_, int p_146119_3_) {
                                            }
                                            
                                            /**
                                            * Fired when the mouse button is released. Equivalent of
                                            * MouseListener.mouseReleased(MouseEvent e).
                                            */
                                            public void mouseReleased(int p_146118_1_, int p_146118_2_) {
                                            }
                                            
                                            /**
                                            * Returns true if the mouse has been pressed on this control. Equivalent of
                                            * MouseListener.mousePressed(MouseEvent e).
                                            */
                                            public boolean mousePressed(Minecraft p_146116_1_, int p_146116_2_, int p_146116_3_) {
                                            return this.enabled && this.visible && p_146116_2_ >= this.xPosition && p_146116_3_ >= this.yPosition
                                            && p_146116_2_ < this.xPosition + this.width && p_146116_3_ < this.yPosition + this.height;
                                            }
                                            
                                            public boolean func_146115_a() {
                                            return this.field_146123_n;
                                            }
                                            
                                            public void func_146111_b(int p_146111_1_, int p_146111_2_) {
                                            }
                                            
                                            public void func_146113_a(SoundHandler p_146113_1_) {
                                            p_146113_1_.playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
                                            }
                                            
                                            public int getButtonWidth() {
                                            return this.width;
                                            }
                                            
                                            public int func_154310_c() {
                                            return this.height;
                                            }
                                            }
                                            

                                            EDIT : Et Robin Quelle utilité de régler les textfileds il marche très bien :S

                                            >! Développeur de Altis-Life (Arma III) sur Minecraft !
                                            >! Site web     : https://lemnoslife.com

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

                                            MINECRAFT FORGE FRANCE © 2024

                                            Powered by NodeBB