MFF

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

    Problème GuiTextField dans un inventaire custom.

    Planifier Épinglé Verrouillé Déplacé Sans suite
    1.7.10
    33 Messages 6 Publieurs 5.7k 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.
    • SCAREXS Hors-ligne
      SCAREX
      dernière édition par

      C’est une fonction à ajouter à la suite des autres.

      PS : http://www.minecraftforgefrance.fr/showthread.php?tid=2766

      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
      • ph1823P Hors-ligne
        ph1823
        dernière édition par

        Justement, c’est ce que j’ai fait, voici ma class :

        [font=Courier Newpackage ]fr.ph1823.MyLife.Gui.Amandes%(#cc7832)[;
        ]
        %(#629755)[*/**
        *]%(#629755)[* * Created by ph1823 - Minecraft on 29/02/2016.
        *]%(#629755)[* */
        *]
        import com.mojang.authlib.GameProfile%(#cc7832)[;
        ]import cpw.mods.fml.client.FMLClientHandler%(#cc7832)[;
        ]import cpw.mods.fml.server.FMLServerHandler%(#cc7832)[;
        ]import fr.ph1823.MyLife.GloryRP%(#cc7832)[;
        ]import fr.ph1823.MyLife.Gui.Amandes.inv.InventoryBackPack%(#cc7832)[;
        ]import fr.ph1823.MyLife.Item.Search%(#cc7832)[;
        ]import net.minecraft.client.gui.*%(#cc7832)[;
        ]import net.minecraft.client.gui.inventory.GuiContainer%(#cc7832)[;
        ]import net.minecraft.client.resources.I18n%(#cc7832)[;
        ]import net.minecraft.entity.player.EntityPlayer%(#cc7832)[;
        ]import net.minecraft.entity.player.InventoryPlayer%(#cc7832)[;
        ]import net.minecraft.item.ItemStack%(#cc7832)[;
        ]import net.minecraft.nbt.NBTBase%(#cc7832)[;
        ]import net.minecraft.server.MinecraftServer%(#cc7832)[;
        ]import net.minecraft.util.IChatComponent%(#cc7832)[;
        ]import net.minecraft.util.ResourceLocation%(#cc7832)[;
        ]
        import org.lwjgl.input.Keyboard%(#cc7832)[;
        ]import org.lwjgl.opengl.GL11%(#cc7832)[;
        ]import fr.ph1823.MyLife.Gui.Amandes.inv.container.*%(#cc7832)[;
        ]
        import java.awt.*%(#cc7832)[;
        ]import java.io.IOException%(#cc7832)[;
        ]import java.net.URI%(#cc7832)[;
        ]import java.util.ArrayList%(#cc7832)[;
        ]import java.util.List%(#cc7832)[;
        ]
        public class Amendes
        
        extends GuiContainer {
          public GuiTextField g%(#cc7832)[;
        ]
                public static final ResourceLocation *texture *= new ResourceLocation("guicustom","textures/a.png")%(#cc7832)[;
        ]        protected InventoryBackPack inv%(#cc7832)[;
        ]        protected InventoryPlayer playerInv%(#cc7832)[;
        ]        public int rows%(#cc7832)[;
        ]
                public Amendes(InventoryPlayer playerInv, InventoryBackPack inv) {
                   super(new ContainerBackPack(playerInv, inv))%(#cc7832)[;
        ]            this.playerInv = playerInv%(#cc7832)[;
        ]            this.inv = inv%(#cc7832)[;
        ]            this.allowUserInput = %(#cc7832)[false;
        ]            %(#808080)[// Calculate the number of rows
        ]            this.rows = inv.getSizeInventory() / 9%(#cc7832)[;
        ]            %(#808080)[// Height of the GUI using the number of rows
        ]            this.ySize = 114 + this.rows * 18%(#cc7832)[;
        ]            
               }
           protected List buttonList = new ArrayList()%(#cc7832)[;
        ]    public void onGuiClosed()
           {
               Keyboard.*enableRepeatEvents*(false)%(#cc7832)[;
        ]    }
               %(#bbb529)[@Override
        ]        protected void drawGuiContainerForegroundLayer(int x, int y) {
                   Keyboard.*enableRepeatEvents*(true)%(#cc7832)[;
        ]          //  this.fontRendererObj.drawString(I18n.format(this.inv.getInventoryName(), new Object[0), 8, 6, 4210752);
        ]            int i = this.height / 4 + 48%(#cc7832)[;
        ]            FontRenderer f = this.mc.fontRenderer%(#cc7832)[;
        ]
                           g = new GuiTextField(f, 55,230, 100,100) %(#cc7832)[;
        ]            g.setVisible(true)%(#cc7832)[;
        ]            g.drawTextBox()%(#cc7832)[;
        ]            g.setText("Pseudo du joueurs")%(#cc7832)[;
        ]            g.setFocused(true)%(#cc7832)[;
        ]
                   g.setEnabled(true)%(#cc7832)[;
        ]
                %(#808080)[//   g.drawTextBox();
        ]%(#808080)[           // this.buttonList.add(g);
        ]            this.buttonList.add(new GuiButton(32, this.width / 2 - 100, i+ 24, 200, 20, "Valide") {
                       %(#bbb529)[@Override
        ]                public void mouseReleased(int x, int y) {
                      mc.currentScreen.confirmClicked(true, 1)%(#cc7832)[;
        ]                    playerInv.closeInventory()%(#cc7832)[;
        ]                    EntityPlayer p1 = playerInv.player%(#cc7832)[;
        ]                    MinecraftServer mc1 = FMLServerHandler.*instance*().getServer()%(#cc7832)[;
        ]                    for(GameProfile g1 : mc1.func_152357_F()) {
                               if(g.getText().equals(g1.getName())) {
                                   EntityPlayer p = mc1.getEntityWorld().func_152378_a(g1.getId())%(#cc7832)[;
        ]                                p.inventory.addItemStackToInventory(new ItemStack(GloryRP.*MenotesItem*,1))%(#cc7832)[;
        ]                        } else {
                                   IChatComponent msg = IChatComponent.Serializer.*func_150699_a*("§4Erreur : la personne demandé n'existe pas.")%(#cc7832)[;
        ]
        
                                   p1.addChatMessage(msg)%(#cc7832)[;
        ]                        }
                           }
        
                       }
                   })%(#cc7832)[;
        ]            int k%(#cc7832)[;
        ]
                    for (k = 0; k < this.buttonList.size(); ++k)
                   {
                       ((GuiButton)this.buttonList.get(k)).drawButton(this.mc, x, y)%(#cc7832)[;
        ]            }
        
                   // this.fontRendererObj.drawString(this.playerInv.hasCustomInventoryName() ? this.playerInv.getInventoryName() : I18n.format(this.playerInv.getInventoryName(), new Object[0), 8, this.ySize - 96 + 2, 4210752);
        ]        }
        
           protected void actionPerformed(GuiButton button)
           {
               if(button.id == 0) {
                   this.mc.currentScreen.confirmClicked(true, 1)%(#cc7832)[;
        ]            playerInv.closeInventory()%(#cc7832)[;
        ]            EntityPlayer p1 = playerInv.player%(#cc7832)[;
        ]            MinecraftServer mc1 = FMLServerHandler.*instance*().getServer()%(#cc7832)[;
        ]            for (GameProfile g1 : mc1.func_152357_F()) {
                       if (g.getText().equals(g1.getName())) {
                           EntityPlayer p = mc1.getEntityWorld().func_152378_a(g1.getId())%(#cc7832)[;
        ]                    p.inventory.addItemStackToInventory(new ItemStack(GloryRP.*MenotesItem*, 1))%(#cc7832)[;
        ]                } else {
                           IChatComponent msg = IChatComponent.Serializer.*func_150699_a*("§4Erreur : la personne demandé n'existe pas.")%(#cc7832)[;
        ]
        
                           p1.addChatMessage(msg)%(#cc7832)[;
        ]                }
                   }
        
               }
           }
           %(#629755)[*/**
        *]%(#629755)[*     * Fired when a key is typed. This is the equivalent of KeyListener.keyTyped(KeyEvent e).
        *]%(#629755)[*     */
        *]    protected void keyTyped(char p_73869_1_, int p_73869_2_) {
               this.g.textboxKeyTyped(p_73869_1_, p_73869_2_)%(#cc7832)[;
        ]        if (p_73869_2_ == 15)
               {
                   this.g.setFocused(!this.g.isFocused())%(#cc7832)[;
        ]         %(#808080)[//   this.field_146308_f.setFocused(!this.field_146308_f.isFocused());
        ]        }
           }
               %(#bbb529)[@Override
        ]        protected void drawGuiContainerBackgroundLayer(float prt, int x, int y) {
                   GL11.*glColor4f*(1.0F, 1.0F, 1.0F, 1.0F)%(#cc7832)[;
        ]            this.mc.getTextureManager().bindTexture(*texture*)%(#cc7832)[;
        ]
                   %(#808080)[// Centering GUI
        ]            int k = (this.width - this.xSize) / 2%(#cc7832)[;
        ]            int l = (this.height - this.ySize) / 2%(#cc7832)[;
        ]
                   %(#808080)[// Drawing the first part of the GUI (slots of the backpack)
        ]            this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.rows * 18 + 17)%(#cc7832)[;
        ]            %(#808080)[// And after the slots from the player's inventory
        ]            this.drawTexturedModalRect(k, l + this.rows * 18 + 17, 0, 126, this.xSize, 96)%(#cc7832)[;
        ]        }
        
           %(#bbb529)[@Override
        ]    protected void mouseClicked(int mouseX, int mouseY, int mouseButton)
           {
               super.mouseClicked(mouseX, mouseY, mouseButton)%(#cc7832)[;
        ]        this.g.mouseClicked(mouseX, mouseY, mouseButton)%(#cc7832)[;
        ]    }
           }
        

        Cordialement, le membre ayant le pseudo "ph1823"

        Ma chaîne YouTube: https://www.youtube.com/c/ph1823
        Mon Twitter : https://twitter.com/ph1823
        Des jeux vidéo moin chers? Alors check ici : http://bit.ly/instaceph ou ici : http://bit.ly/g2aph

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

          Voici comment j’ajoute un GuiTextField à mon Gui
          D’abord tu crée la variable en dehors de la classe sans l’initialiser.
          private GuiTextField name;

          Et tu peux maintenant l’initialiser dans la méthode initGui:

          name= new GuiTextField(fontRenderer, width / 2 - 100, height / 4 + 10, 200, 20);
                 name.setMaxStringLength(31);
                 name.func_50033_b(true);Soit la méthode setFocused, soit setEnabled. Au pire rajoute les deux
                 name.setText(camel.name);

          Ensuite tu te sers de la méthode updateScreen pour faire la chose suivante:

          public void updateScreen()
             {
                 name.updateCursorCounter();
             }

          Pour la méthode keyTyped, ce que tu as mis me semble déjà être correct. Je regarderai quand même si c’est vraiment le cas, quand j’aurai le temps.
          Quant à la méthode mouseClicked, idem…

          Et enfin la dernière chose à ajouter est:

          public void drawScreen(int i, int j, float f)
             {
                 namescreen.drawTextBox();
                 super.drawScreen(i, j, f);
             }

          Voilà après j’ai peut-être pas les mêmes mappings que toi, notamment pour la méthode func_50033_b, au pire dis le moi, je rechercherai l’équivalent 🙂

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

            
            

            Pourquoi c’est dans la méthode “[size=smalldrawGuiContainerForegroundLayer][size=small(][size=smallint] [size=smallx][size=small,] int [size=smally][font=Courier New)” ]?!?!?
            Il faut mettre ça dans la méthode init().

            Le reste me semble correct.

            Si je vous ai aidé, n'oubliez pas d’être heureux, j'aiderai encore +

            AymericRed, moddeur expérimenté qui aide sur ce forum et qui peut accepter de faire un mod Forge rémunéré de temps en temps.

            Mes tutos : Table de craft, plugin NEI, plugin JEI, modifier l'overlay
            Je suis un membre apprécié et joueur, j'ai déjà obtenu 6 points de réputation.

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

              Bonjours, voici ma class :

              [font=Courier Newpackage ]fr.ph1823.MyLife.Gui.Amandes%(#cc7832)[;
              ]
              %(#629755)[*/**
              *]%(#629755)[* * Created by ph1823 - Minecraft on 29/02/2016.
              *]%(#629755)[* */
              *]
              import com.mojang.authlib.GameProfile%(#cc7832)[;
              ]import cpw.mods.fml.client.FMLClientHandler%(#cc7832)[;
              ]import cpw.mods.fml.server.FMLServerHandler%(#cc7832)[;
              ]import fr.ph1823.MyLife.GloryRP%(#cc7832)[;
              ]import fr.ph1823.MyLife.Gui.Amandes.inv.InventoryBackPack%(#cc7832)[;
              ]import fr.ph1823.MyLife.Item.Search%(#cc7832)[;
              ]import net.minecraft.client.gui.*%(#cc7832)[;
              ]import net.minecraft.client.gui.inventory.GuiContainer%(#cc7832)[;
              ]import net.minecraft.client.resources.I18n%(#cc7832)[;
              ]import net.minecraft.entity.player.EntityPlayer%(#cc7832)[;
              ]import net.minecraft.entity.player.InventoryPlayer%(#cc7832)[;
              ]import net.minecraft.item.ItemStack%(#cc7832)[;
              ]import net.minecraft.nbt.NBTBase%(#cc7832)[;
              ]import net.minecraft.server.MinecraftServer%(#cc7832)[;
              ]import net.minecraft.util.IChatComponent%(#cc7832)[;
              ]import net.minecraft.util.ResourceLocation%(#cc7832)[;
              ]
              import org.lwjgl.input.Keyboard%(#cc7832)[;
              ]import org.lwjgl.opengl.GL11%(#cc7832)[;
              ]import fr.ph1823.MyLife.Gui.Amandes.inv.container.*%(#cc7832)[;
              ]
              import java.awt.*%(#cc7832)[;
              ]import java.io.IOException%(#cc7832)[;
              ]import java.net.URI%(#cc7832)[;
              ]import java.util.ArrayList%(#cc7832)[;
              ]import java.util.List%(#cc7832)[;
              ]
              public class Amendes
              
              extends GuiContainer {
                public GuiTextField g%(#cc7832)[;
              ]
                      public static final ResourceLocation *texture *= new ResourceLocation("guicustom","textures/a.png")%(#cc7832)[;
              ]        protected InventoryBackPack inv%(#cc7832)[;
              ]        protected InventoryPlayer playerInv%(#cc7832)[;
              ]        public int rows%(#cc7832)[;
              ]
                      public Amendes(InventoryPlayer playerInv, InventoryBackPack inv) {
                         super(new ContainerBackPack(playerInv, inv))%(#cc7832)[;
              ]            this.playerInv = playerInv%(#cc7832)[;
              ]            this.inv = inv%(#cc7832)[;
              ]            this.allowUserInput = %(#cc7832)[false;
              ]            %(#808080)[// Calculate the number of rows
              ]            this.rows = inv.getSizeInventory() / 9%(#cc7832)[;
              ]            %(#808080)[// Height of the GUI using the number of rows
              ]            this.ySize = 114 + this.rows * 18%(#cc7832)[;
              ]
                     }
                 protected List buttonList = new ArrayList()%(#cc7832)[;
              ]
                  public void init() {
              
                     int i = this.height / 4 + 48%(#cc7832)[;
              ]        FontRenderer f = this.mc.fontRenderer%(#cc7832)[;
              ]
                     g = new GuiTextField(f, 55,230, 100,100) %(#cc7832)[;
              ]        g.setVisible(true)%(#cc7832)[;
              ]        g.drawTextBox()%(#cc7832)[;
              ]        g.setText("Pseudo du joueurs")%(#cc7832)[;
              ]        g.setFocused(true)%(#cc7832)[;
              ]
                     g.setEnabled(true)%(#cc7832)[;
              ]
                     %(#808080)[//   g.drawTextBox();
              ]%(#808080)[        // this.buttonList.add(g);
              ]        this.buttonList.add(new GuiButton(32, this.width / 2 - 100, i+ 24, 200, 20, "Valide") {
                         %(#bbb529)[@Override
              ]            public void mouseReleased(int x, int y) {
                             mc.currentScreen.confirmClicked(true, 1)%(#cc7832)[;
              ]                playerInv.closeInventory()%(#cc7832)[;
              ]                EntityPlayer p1 = playerInv.player%(#cc7832)[;
              ]                MinecraftServer mc1 = FMLServerHandler.*instance*().getServer()%(#cc7832)[;
              ]                for(GameProfile g1 : mc1.func_152357_F()) {
                                 if(g.getText().equals(g1.getName())) {
                                     EntityPlayer p = mc1.getEntityWorld().func_152378_a(g1.getId())%(#cc7832)[;
              ]                        p.inventory.addItemStackToInventory(new ItemStack(GloryRP.*MenotesItem*,1))%(#cc7832)[;
              ]                    } else {
                                     IChatComponent msg = IChatComponent.Serializer.*func_150699_a*("§4Erreur : la personne demandé n'existe pas.")%(#cc7832)[;
              ]
              
                                     p1.addChatMessage(msg)%(#cc7832)[;
              ]                    }
                             }
              
                         }
                     })%(#cc7832)[;
              ]
                 }
                 public void onGuiClosed()
                 {
                     Keyboard.*enableRepeatEvents*(false)%(#cc7832)[;
              ]    }
                     %(#bbb529)[@Override
              ]        protected void drawGuiContainerForegroundLayer(int x, int y) {
                         Keyboard.*enableRepeatEvents*(true)%(#cc7832)[;
              ]          //  this.fontRendererObj.drawString(I18n.format(this.inv.getInventoryName(), new Object[0), 8, 6, 4210752);
              ]
                         int k%(#cc7832)[;
              ]
                          for (k = 0; k < this.buttonList.size(); ++k)
                         {
                             ((GuiButton)this.buttonList.get(k)).drawButton(this.mc, x, y)%(#cc7832)[;
              ]            }
              
                         // this.fontRendererObj.drawString(this.playerInv.hasCustomInventoryName() ? this.playerInv.getInventoryName() : I18n.format(this.playerInv.getInventoryName(), new Object[0), 8, this.ySize - 96 + 2, 4210752);
              ]        }
              
                 protected void actionPerformed(GuiButton button)
                 {
                     if(button.id == 0) {
                         this.mc.currentScreen.confirmClicked(true, 1)%(#cc7832)[;
              ]            playerInv.closeInventory()%(#cc7832)[;
              ]            EntityPlayer p1 = playerInv.player%(#cc7832)[;
              ]            MinecraftServer mc1 = FMLServerHandler.*instance*().getServer()%(#cc7832)[;
              ]            for (GameProfile g1 : mc1.func_152357_F()) {
                             if (g.getText().equals(g1.getName())) {
                                 EntityPlayer p = mc1.getEntityWorld().func_152378_a(g1.getId())%(#cc7832)[;
              ]                    p.inventory.addItemStackToInventory(new ItemStack(GloryRP.*MenotesItem*, 1))%(#cc7832)[;
              ]                } else {
                                 IChatComponent msg = IChatComponent.Serializer.*func_150699_a*("§4Erreur : la personne demandé n'existe pas.")%(#cc7832)[;
              ]
              
                                 p1.addChatMessage(msg)%(#cc7832)[;
              ]                }
                         }
              
                     }
                 }
                 %(#629755)[*/**
              *]%(#629755)[*     * Fired when a key is typed. This is the equivalent of KeyListener.keyTyped(KeyEvent e).
              *]%(#629755)[*     */
              *]    protected void keyTyped(char p_73869_1_, int p_73869_2_) {
                     this.g.textboxKeyTyped(p_73869_1_, p_73869_2_)%(#cc7832)[;
              ]        if (p_73869_2_ == 15)
                     {
                         this.g.setFocused(!this.g.isFocused())%(#cc7832)[;
              ]         %(#808080)[//   this.field_146308_f.setFocused(!this.field_146308_f.isFocused());
              ]        }
                 }
                     %(#bbb529)[@Override
              ]        protected void drawGuiContainerBackgroundLayer(float prt, int x, int y) {
                         GL11.*glColor4f*(1.0F, 1.0F, 1.0F, 1.0F)%(#cc7832)[;
              ]            this.mc.getTextureManager().bindTexture(*texture*)%(#cc7832)[;
              ]
                         %(#808080)[// Centering GUI
              ]            int k = (this.width - this.xSize) / 2%(#cc7832)[;
              ]            int l = (this.height - this.ySize) / 2%(#cc7832)[;
              ]
                         %(#808080)[// Drawing the first part of the GUI (slots of the backpack)
              ]            this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.rows * 18 + 17)%(#cc7832)[;
              ]            %(#808080)[// And after the slots from the player's inventory
              ]            this.drawTexturedModalRect(k, l + this.rows * 18 + 17, 0, 126, this.xSize, 96)%(#cc7832)[;
              ]        }
              
                 public void updateScreen()
                 {
                     g.updateCursorCounter()%(#cc7832)[;
              ]    }
              
                 %(#bbb529)[@Override
              ]    protected void mouseClicked(int mouseX, int mouseY, int mouseButton)
                 {
                     super.mouseClicked(mouseX, mouseY, mouseButton)%(#cc7832)[;
              ]        this.g.mouseClicked(mouseX, mouseY, mouseButton)%(#cc7832)[;
              ]    }
              
                 public void drawScreen(int i, int j, float f)
                 {
                    %(#808080)[// mc.currentScreen.drawTextBox();
              ]        super.drawScreen(i, j, f)%(#cc7832)[;
              ]    }
              
                 }
              

              P.S Sans le init ca fait crash, je voulait savoir si avec comme ca ca serais bon?

              Cordialement, le membre ayant le pseudo "ph1823"

              Ma chaîne YouTube: https://www.youtube.com/c/ph1823
              Mon Twitter : https://twitter.com/ph1823
              Des jeux vidéo moin chers? Alors check ici : http://bit.ly/instaceph ou ici : http://bit.ly/g2aph

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

                Met un @Override car je sais plus si c’est init() ou initGui()

                Si je vous ai aidé, n'oubliez pas d’être heureux, j'aiderai encore +

                AymericRed, moddeur expérimenté qui aide sur ce forum et qui peut accepter de faire un mod Forge rémunéré de temps en temps.

                Mes tutos : Table de craft, plugin NEI, plugin JEI, modifier l'overlay
                Je suis un membre apprécié et joueur, j'ai déjà obtenu 6 points de réputation.

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

                  c’est initGui, il faut toujours mettre les @Override

                  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
                  • ph1823P Hors-ligne
                    ph1823
                    dernière édition par

                    Bonjours, c’est bien ce que j’ai fait sauf que maintenant le GuiTextField ne s’affiche pas, et en plus le validé ne fait rien. voici le code :

                    
                    package fr.ph1823.MyLife.Gui.Amandes;
                    
                    /**
                    * Created by ph1823 - Minecraft on 29/02/2016.
                    */
                    
                    import com.mojang.authlib.GameProfile;
                    import cpw.mods.fml.client.FMLClientHandler;
                    import cpw.mods.fml.server.FMLServerHandler;
                    import fr.ph1823.MyLife.GloryRP;
                    import fr.ph1823.MyLife.Gui.Amandes.inv.InventoryBackPack;
                    import fr.ph1823.MyLife.Item.Search;
                    import net.minecraft.client.gui.*;
                    import net.minecraft.client.gui.inventory.GuiContainer;
                    import net.minecraft.client.resources.I18n;
                    import net.minecraft.entity.player.EntityPlayer;
                    import net.minecraft.entity.player.InventoryPlayer;
                    import net.minecraft.item.ItemStack;
                    import net.minecraft.nbt.NBTBase;
                    import net.minecraft.server.MinecraftServer;
                    import net.minecraft.util.IChatComponent;
                    import net.minecraft.util.ResourceLocation;
                    
                    import org.lwjgl.input.Keyboard;
                    import org.lwjgl.opengl.GL11;
                    import fr.ph1823.MyLife.Gui.Amandes.inv.container.*;
                    
                    import java.awt.*;
                    import java.io.IOException;
                    import java.net.URI;
                    import java.util.ArrayList;
                    import java.util.List;
                    
                    public class Amendes
                    
                    extends GuiContainer {
                    public GuiTextField g;
                    
                    public static final ResourceLocation texture = new ResourceLocation("guicustom","textures/a.png");
                    protected InventoryBackPack inv;
                    protected InventoryPlayer playerInv;
                    public int rows;
                    
                    public Amendes(InventoryPlayer playerInv, InventoryBackPack inv) {
                    super(new ContainerBackPack(playerInv, inv));
                    this.playerInv = playerInv;
                    this.inv = inv;
                    this.allowUserInput = false;
                    // Calculate the number of rows
                    this.rows = inv.getSizeInventory() / 9;
                    // Height of the GUI using the number of rows
                    this.ySize = 114 + this.rows * 18;
                    
                    }
                    protected List buttonList = new ArrayList();
                    @Override
                    public void initGui() {
                    
                    int i = this.height / 4 + 48;
                    FontRenderer f = this.mc.fontRenderer;
                    
                    g = new GuiTextField(f, 55,230, 100,100) ;
                    g.setVisible(true);
                    g.drawTextBox();
                    g.setText("Pseudo du joueurs");
                    g.setFocused(true);
                    
                    g.setEnabled(true);
                    
                    // g.drawTextBox();
                    // this.buttonList.add(g);
                    this.buttonList.add(new GuiButton(32, this.width / 2 - 100, i+ 24, 200, 20, "Valide") {
                    @Override
                    public void mouseReleased(int x, int y) {
                    mc.currentScreen.confirmClicked(true, 1);
                    playerInv.closeInventory();
                    EntityPlayer p1 = playerInv.player;
                    MinecraftServer mc1 = FMLServerHandler.instance().getServer();
                    for(GameProfile g1 : mc1.func_152357_F()) {
                    if(g.getText().equals(g1.getName())) {
                    EntityPlayer p = mc1.getEntityWorld().func_152378_a(g1.getId());
                    p.inventory.addItemStackToInventory(new ItemStack(GloryRP.MenotesItem,1));
                    } else {
                    IChatComponent msg = IChatComponent.Serializer.func_150699_a("§4Erreur : la personne demandé n'existe pas.");
                    
                    p1.addChatMessage(msg);
                    }
                    }
                    int k;
                    for (k = 0; k < buttonList.size(); ++k) {
                    ((GuiButton) buttonList.get(k)).drawButton(mc, x, y);
                    }
                    }
                    });
                    
                    }
                    public void onGuiClosed()
                    {
                    Keyboard.enableRepeatEvents(false);
                    }
                    protected void drawGuiContainerForegroundLayer(int x, int y) {
                    int k;
                    for (k = 0; k < this.buttonList.size(); ++k) {
                    ((GuiButton) this.buttonList.get(k)).drawButton(this.mc, x, y);
                    }
                    }
                    /* @Override
                    protected void drawGuiContainerForegroundLayer(int x, int y) {
                    Keyboard.enableRepeatEvents(true);
                    // this.fontRendererObj.drawString(I18n.format(this.inv.getInventoryName(), new Object[0]), 8, 6, 4210752);
                    
                    int k;
                    
                    for (k = 0; k < this.buttonList.size(); ++k)
                    {
                    ((GuiButton)this.buttonList.get(k)).drawButton(this.mc, x, y);
                    }
                    
                    // this.fontRendererObj.drawString(this.playerInv.hasCustomInventoryName() ? this.playerInv.getInventoryName() : I18n.format(this.playerInv.getInventoryName(), new Object[0]), 8, this.ySize - 96 + 2, 4210752);
                    }*/
                    
                    protected void actionPerformed(GuiButton button)
                    {
                    if(button.id == 0) {
                    this.mc.currentScreen.confirmClicked(true, 1);
                    playerInv.closeInventory();
                    EntityPlayer p1 = playerInv.player;
                    MinecraftServer mc1 = FMLServerHandler.instance().getServer();
                    for (GameProfile g1 : mc1.func_152357_F()) {
                    if (g.getText().equals(g1.getName())) {
                    EntityPlayer p = mc1.getEntityWorld().func_152378_a(g1.getId());
                    p.inventory.addItemStackToInventory(new ItemStack(GloryRP.MenotesItem, 1));
                    } else {
                    IChatComponent msg = IChatComponent.Serializer.func_150699_a("§4Erreur : la personne demandé n'existe pas.");
                    
                    p1.addChatMessage(msg);
                    }
                    }
                    
                    }
                    }
                    /**
                    * Fired when a key is typed. This is the equivalent of KeyListener.keyTyped(KeyEvent e).
                    */
                    protected void keyTyped(char p_73869_1_, int p_73869_2_) {
                    this.g.textboxKeyTyped(p_73869_1_, p_73869_2_);
                    if (p_73869_2_ == 15)
                    {
                    this.g.setFocused(!this.g.isFocused());
                    // this.field_146308_f.setFocused(!this.field_146308_f.isFocused());
                    }
                    }
                    @Override
                    protected void drawGuiContainerBackgroundLayer(float prt, int x, int y) {
                    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
                    this.mc.getTextureManager().bindTexture(texture);
                    
                    // Centering GUI
                    int k = (this.width - this.xSize) / 2;
                    int l = (this.height - this.ySize) / 2;
                    
                    // Drawing the first part of the GUI (slots of the backpack)
                    this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.rows * 18 + 17);
                    // And after the slots from the player's inventory
                    this.drawTexturedModalRect(k, l + this.rows * 18 + 17, 0, 126, this.xSize, 96);
                    }
                    
                    public void updateScreen()
                    {
                    g.updateCursorCounter();
                    }
                    
                    @Override
                    protected void mouseClicked(int mouseX, int mouseY, int mouseButton)
                    {
                    super.mouseClicked(mouseX, mouseY, mouseButton);
                    this.g.mouseClicked(mouseX, mouseY, mouseButton);
                    }
                    
                    public void drawScreen(int i, int j, float f)
                    {
                    // mc.currentScreen.drawTextBox();
                    super.drawScreen(i, j, f);
                    }
                    
                    }
                    
                    

                    Merci de vos réponse.

                    Cordialement, le membre ayant le pseudo "ph1823"

                    Ma chaîne YouTube: https://www.youtube.com/c/ph1823
                    Mon Twitter : https://twitter.com/ph1823
                    Des jeux vidéo moin chers? Alors check ici : http://bit.ly/instaceph ou ici : http://bit.ly/g2aph

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

                      Ah oui il faut que tu laisses g.drawTextBox dans la fonction draw où il était avant.

                      Si je vous ai aidé, n'oubliez pas d’être heureux, j'aiderai encore +

                      AymericRed, moddeur expérimenté qui aide sur ce forum et qui peut accepter de faire un mod Forge rémunéré de temps en temps.

                      Mes tutos : Table de craft, plugin NEI, plugin JEI, modifier l'overlay
                      Je suis un membre apprécié et joueur, j'ai déjà obtenu 6 points de réputation.

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

                        Bonjours, cela ne change rien, quand on tente de changé le texte ou autre cela ne marche toujours pas même en appuyant sur validé 😕

                        Cordialement, le membre ayant le pseudo "ph1823"

                        Ma chaîne YouTube: https://www.youtube.com/c/ph1823
                        Mon Twitter : https://twitter.com/ph1823
                        Des jeux vidéo moin chers? Alors check ici : http://bit.ly/instaceph ou ici : http://bit.ly/g2aph

                        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

                          Punaise c’est pourtant pas compliqué de faire une texte box x)
                          Il suffit de reprendre le même code que dans GuiRepair

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

                            Surtout que je t’ai donné tous les éléments. Clean entièrement ta classe et repart à 0, en faisant des pauses de temps en temps pour vérifier le résultat. Il n’y a que comme ça que tu y arriveras…

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

                              Bonjours, je viens de suivre vos consiel sauf que ca ne marche toujours pas , et 30secondes après, ceci fait crash minecraft voici l’erreur :

                              19:46:14] [Client thread/INFO] [STDOUT/]: [net.minecraft.client.Minecraft:func_71377_b:349]: –-- Minecraft Crash Report ----
                              // Shall we play a game?
                              
                              Time: 06/03/16 19:46
                              Description: Rendering screen
                              
                              java.lang.NullPointerException: Rendering screen
                              at net.minecraft.client.gui.GuiNewChat.func_146236_a(GuiNewChat.java:330)
                              at net.minecraft.client.gui.GuiChat.func_73863_a(GuiChat.java:386)
                              at net.minecraft.client.renderer.EntityRenderer.func_78480_b(EntityRenderer.java:1358)
                              at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:1001)
                              at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:898)
                              at net.minecraft.client.main.Main.main(SourceFile:148)
                              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                              at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                              at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                              at java.lang.reflect.Method.invoke(Unknown Source)
                              at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
                              at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
                              
                              A detailed walkthrough of the error, its code path and all known details is as follows:
                              ---------------------------------------------------------------------------------------
                              
                              -- Head --
                              Stacktrace:
                              at net.minecraft.client.gui.GuiNewChat.func_146236_a(GuiNewChat.java:330)
                              at net.minecraft.client.gui.GuiChat.func_73863_a(GuiChat.java:386)
                              
                              -- Screen render details --
                              Details:
                              Screen name: net.minecraft.client.gui.GuiChat
                              Mouse location: Scaled: (243, 128). Absolute: (972, 503)
                              Screen size: Scaled: (480, 255). Absolute: (1920, 1017). Scale factor of 4
                              
                              -- Affected level --
                              Details:
                              Level name: MpServer
                              All players: 1 total; [EntityClientPlayerMP['ph1823'/36, l='MpServer', x=-219,80, y=66,06, z=940,26]]
                              Chunk stats: MultiplayerChunkCache: 416, 416
                              Level seed: 0
                              Level generator: ID 00 - default, ver 1\. Features enabled: false
                              Level generator options: 
                              Level spawn location: World: (-225,63,941), Chunk: (at 15,3,13 in -15,58; contains blocks -240,0,928 to -225,255,943), Region: (-1,1; contains chunks -32,32 to -1,63, blocks -512,0,512 to -1,255,1023)
                              Level time: 50906705 game time, 13130160745 day time
                              Level dimension: 0
                              Level storage version: 0x00000 - Unknown?
                              Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false)
                              Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: false
                              Forced entities: 17 total; [EntitySheep['Sheep'/0, l='MpServer', x=-212,53, y=47,00, z=986,16], EntitySheep['Sheep'/1, l='MpServer', x=-211,72, y=47,00, z=987,53], EntityCow['Cow'/2, l='MpServer', x=-208,63, y=47,00, z=992,72], EntityCow['Cow'/3, l='MpServer', x=-213,75, y=47,00, z=989,75], EntityChicken['Chicken'/4, l='MpServer', x=-196,56, y=47,00, z=989,53], EntityPig['Pig'/5, l='MpServer', x=-202,72, y=47,00, z=990,28], EntityChicken['Chicken'/6, l='MpServer', x=-194,56, y=47,00, z=989,47], EntityPig['Pig'/7, l='MpServer', x=-201,47, y=47,00, z=990,22], EntityPig['Pig'/8, l='MpServer', x=-177,44, y=44,02, z=977,45], EntitySheep['Sheep'/9, l='MpServer', x=-177,44, y=43,00, z=977,53], EntityPig['Pig'/10, l='MpServer', x=-177,44, y=44,00, z=977,53], EntityClientPlayerMP['ph1823'/36, l='MpServer', x=-219,80, y=66,06, z=940,26], EntityChicken['Chicken'/12, l='MpServer', x=-173,16, y=42,00, z=975,19], EntityCow['Cow'/13, l='MpServer', x=-173,47, y=42,00, z=974,16], EntityCow['Cow'/14, l='MpServer', x=-175,88, y=42,00, z=974,97], EntityChicken['Chicken'/15, l='MpServer', x=-173,88, y=42,00, z=973,16], EntitySheep['Sheep'/16, l='MpServer', x=-175,13, y=42,00, z=977,53]]
                              Retry entities: 0 total; []
                              Server brand: kcauldron,cauldron,craftbukkit,mcpc,fml,forge
                              Server type: Non-integrated multiplayer server
                              Stacktrace:
                              at net.minecraft.client.multiplayer.WorldClient.func_72914_a(WorldClient.java:373)
                              at net.minecraft.client.Minecraft.func_71396_d(Minecraft.java:2444)
                              at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:919)
                              at net.minecraft.client.main.Main.main(SourceFile:148)
                              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                              at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                              at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                              at java.lang.reflect.Method.invoke(Unknown Source)
                              at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
                              at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
                              
                              – System Details --
                              Details:
                              Minecraft Version: 1.7.10
                              Operating System: Windows 10 (amd64) version 10.0
                              Java Version: 1.8.0_71, Oracle Corporation
                              Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
                              Memory: 693332664 bytes (661 MB) / 1588162560 bytes (1514 MB) up to 2100035584 bytes (2002 MB)
                              JVM Flags: 3 total; -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:-UseAdaptiveSizePolicy
                              AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
                              IntCache: cache: 0, tcache: 0, allocated: 13, tallocated: 95
                              FML: MCP v9.05 FML v7.10.99.99 Minecraft Forge 10.13.4.1448 Optifine OptiFine_1.7.10_HD_U_C1 18 mods loaded, 18 mods active
                              States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored
                              UCHIJA mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) 
                              UCHIJA FML{7.10.99.99} [Forge Mod Loader] (forge-1.7.10-10.13.4.1448-1.7.10.jar) 
                              UCHIJA Forge{10.13.4.1448} [Minecraft Forge] (forge-1.7.10-10.13.4.1448-1.7.10.jar) 
                              UCHIJA Backpack{2.0.1} [Backpack] (Backpacks-Mod.jar) 
                              UCHIJA BiblioCraft{1.10.4} [BiblioCraft] (BiblioCraft[v1.10.4][MC1.7.10].jar) 
                              UCHIJA CarpentersBlocks{3.3.0 DEV R4} [Carpenter's Blocks] (Carpenter_s_Blocks.jar) 
                              UCHIJA chisel{1.5.7} [Chisel] (Chisel[v1.5.7][1.7.10].jar) 
                              UCHIJA customnpcs{1.7.10d} [CustomNpcs] (CustomNPCs[vd][1.7.10].jar) 
                              UCHIJA PTRModelLib{1.0.0} [PTRModelLib] (Decocraft-2.1.1_1.7.10.jar) 
                              UCHIJA props{2.1.1} [Decocraft] (Decocraft-2.1.1_1.7.10.jar) 
                              UCHIJA flansmod{4.10.0} [Flan's Mod] (FlansMod-1.7.10-4.10.0.jar) 
                              UCHIJA gvc{0.6.1} [§aGliby's§f Voice Chat Mod] (GlibysVC[1.7.10].jar) 
                              UCHIJA mm{1.0} [Minecraft Money] (MinecraftMoney[1.7.10].jar) 
                              UCHIJA Monoblocks{1.10.10} [§1M§2o§3n§4o§5b§6l§7o§8c§9k§as] (Monoblocks-1.10.10.jar) 
                              UCHIJA MonoblocksMultipart{1.10.10} [MonoblocksMultipart] (Monoblocks-1.10.10.jar) 
                              UCHIJA cfm{3.4.7} [§9MrCrayfish's Furniture Mod] (MrCrayfishFurnitureModv3.4.7[1.7.10].jar) 
                              UCHIJA MyLife{1.0} [MyLife] (MyLife.jar) 
                              UCHIJA securitycraft{v1.7.4.2} [SecurityCraft] (SecurityCraft[1.7.10].jar) 
                              GL info: ' Vendor: 'NVIDIA Corporation' Version: '4.5.0 NVIDIA 361.91' Renderer: 'GeForce GTX 750 Ti/PCIe/SSE2'
                              Launched Version: 1.7.10
                              LWJGL: 2.9.1
                              OpenGL: GeForce GTX 750 Ti/PCIe/SSE2 GL version 4.5.0 NVIDIA 361.91, NVIDIA Corporation
                              GL Caps: Using GL 1.3 multitexturing.
                              Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported.
                              Anisotropic filtering is supported and maximum anisotropy is 16.
                              Shaders are available because OpenGL 2.1 is supported.
                              
                              Is Modded: Definitely; Client brand changed to 'fml,forge'
                              Type: Client (map_client.txt)
                              Resource Packs: []
                              Current Language: English (US)
                              Profiler Position: N/A (disabled)
                              Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
                              Anisotropic Filtering: Off (1)
                              [19:46:14] [Client thread/INFO] [STDOUT/]: [net.minecraft.client.Minecraft:func_71377_b:359]: #@!@# Game crashed! Crash report saved to: #@!@# C:\Users\ph1823 - Minecraft\AppData\Roaming\.MyLife\crash-reports\crash-2016-03-06_19.46.13-client.txt
                              

                              Le code :

                              [font=Courier Newpackage ]fr.ph1823.MyLife.Gui.Amandes%(#cc7832)[;
                              ]
                              %(#629755)[*/**
                              *]%(#629755)[* * Created by ph1823 - Minecraft on 29/02/2016.
                              *]%(#629755)[* */
                              *]
                              import com.mojang.authlib.GameProfile%(#cc7832)[;
                              ]import cpw.mods.fml.client.FMLClientHandler%(#cc7832)[;
                              ]import cpw.mods.fml.server.FMLServerHandler%(#cc7832)[;
                              ]import fr.ph1823.MyLife.GloryRP%(#cc7832)[;
                              ]import fr.ph1823.MyLife.Gui.Amandes.inv.InventoryBackPack%(#cc7832)[;
                              ]import fr.ph1823.MyLife.Item.Search%(#cc7832)[;
                              ]import net.minecraft.client.gui.*%(#cc7832)[;
                              ]import net.minecraft.client.gui.inventory.GuiContainer%(#cc7832)[;
                              ]import net.minecraft.client.resources.I18n%(#cc7832)[;
                              ]import net.minecraft.entity.player.EntityPlayer%(#cc7832)[;
                              ]import net.minecraft.entity.player.InventoryPlayer%(#cc7832)[;
                              ]import net.minecraft.item.ItemStack%(#cc7832)[;
                              ]import net.minecraft.nbt.NBTBase%(#cc7832)[;
                              ]import net.minecraft.server.MinecraftServer%(#cc7832)[;
                              ]import net.minecraft.util.IChatComponent%(#cc7832)[;
                              ]import net.minecraft.util.ResourceLocation%(#cc7832)[;
                              ]
                              import org.lwjgl.input.Keyboard%(#cc7832)[;
                              ]import org.lwjgl.opengl.GL11%(#cc7832)[;
                              ]import fr.ph1823.MyLife.Gui.Amandes.inv.container.*%(#cc7832)[;
                              ]
                              import java.awt.*%(#cc7832)[;
                              ]import java.io.IOException%(#cc7832)[;
                              ]import java.net.URI%(#cc7832)[;
                              ]import java.util.ArrayList%(#cc7832)[;
                              ]import java.util.List%(#cc7832)[;
                              ]
                              public class Amendes
                              
                              extends GuiContainer {
                                private GuiTextField g%(#cc7832)[;
                              ]
                                      public static final ResourceLocation *texture *= new ResourceLocation("guicustom","textures/a.png")%(#cc7832)[;
                              ]        protected InventoryBackPack inv%(#cc7832)[;
                              ]        protected InventoryPlayer playerInv%(#cc7832)[;
                              ]        public int rows%(#cc7832)[;
                              ]
                                      public Amendes(InventoryPlayer playerInv, InventoryBackPack inv) {
                                         super(new ContainerBackPack(playerInv, inv))%(#cc7832)[;
                              ]            this.playerInv = playerInv%(#cc7832)[;
                              ]            this.inv = inv%(#cc7832)[;
                              ]            this.allowUserInput = %(#cc7832)[false;
                              ]            %(#808080)[// Calculate the number of rows
                              ]            this.rows = inv.getSizeInventory() / 9%(#cc7832)[;
                              ]            %(#808080)[// Height of the GUI using the number of rows
                              ]            this.ySize = 114 + this.rows * 18%(#cc7832)[;
                              ]
                                     }
                                 protected List buttonList = new ArrayList()%(#cc7832)[;
                              ]    %(#bbb529)[@Override
                              ]    public void initGui() {
                              
                                     int i = this.height / 4 + 48%(#cc7832)[;
                              ]        FontRenderer f = this.mc.fontRenderer%(#cc7832)[;
                              ]
                                     g = new GuiTextField(f, 55,230, 100,100)%(#cc7832)[;
                              ]        g.setMaxStringLength(31)%(#cc7832)[;
                              ]        g.setFocused(true)%(#cc7832)[;
                              ]        g.setEnabled(true)%(#cc7832)[;
                              ]        g.setVisible(true)%(#cc7832)[;
                              ]        g.drawTextBox()%(#cc7832)[;
                              ]        g.setText("Pseudo du joueurs")%(#cc7832)[;
                              ]
                              
                                     %(#808080)[//   g.drawTextBox();
                              ]%(#808080)[        // this.buttonList.add(g);
                              ]        this.buttonList.add(new GuiButton(32, this.width / 2 - 100, i+ 24, 200, 20, "Valide") {
                                         %(#bbb529)[@Override
                              ]            public void mouseReleased(int x, int y) {
                                             mc.currentScreen.confirmClicked(true, 1)%(#cc7832)[;
                              ]                playerInv.closeInventory()%(#cc7832)[;
                              ]                EntityPlayer p1 = playerInv.player%(#cc7832)[;
                              ]                MinecraftServer mc1 = FMLServerHandler.*instance*().getServer()%(#cc7832)[;
                              ]                for(GameProfile g1 : mc1.func_152357_F()) {
                                                 if(g.getText().equals(g1.getName())) {
                                                     EntityPlayer p = mc1.getEntityWorld().func_152378_a(g1.getId())%(#cc7832)[;
                              ]                        p.inventory.addItemStackToInventory(new ItemStack(GloryRP.*MenotesItem*,1))%(#cc7832)[;
                              ]                    } else {
                                                     IChatComponent msg = IChatComponent.Serializer.*func_150699_a*("§4Erreur : la personne demandé n'existe pas.")%(#cc7832)[;
                              ]
                              
                                                     p1.addChatMessage(msg)%(#cc7832)[;
                              ]                    }
                                             }
                                             int k%(#cc7832)[;
                              ]                for (k = 0; k < buttonList.size(); ++k) {
                                                 ((GuiButton) buttonList.get(k)).drawButton(mc, x, y)%(#cc7832)[;
                              ]                }
                                         }
                                     })%(#cc7832)[;
                              ]
                              
                                 }
                                 public void onGuiClosed()
                                 {
                                     Keyboard.*enableRepeatEvents*(false)%(#cc7832)[;
                              ]    }
                                 protected void drawGuiContainerForegroundLayer(int x, int y) {
                                 super.drawGuiContainerForegroundLayer(x, y)%(#cc7832)[;
                              ]        int i = this.height / 4 + 48%(#cc7832)[;
                              ]        FontRenderer f = this.mc.fontRenderer%(#cc7832)[;
                              ]
                                     g = new GuiTextField(f, 55,230, 100,100) %(#cc7832)[;
                              ]        g.setVisible(true)%(#cc7832)[;
                              ]        g.drawTextBox()%(#cc7832)[;
                              ]        g.setText("Pseudo du joueurs")%(#cc7832)[;
                              ]        g.setFocused(true)%(#cc7832)[;
                              ]
                                     g.setEnabled(true)%(#cc7832)[;
                              ]
                              
                                      int k%(#cc7832)[;
                              ]        for (k = 0; k < this.buttonList.size(); ++k) {
                                         ((GuiButton) this.buttonList.get(k)).drawButton(this.mc, x, y)%(#cc7832)[;
                              ]        }
                                 }
                                    %(#808080)[/* @Override
                              ]%(#808080)[        protected void drawGuiContainerForegroundLayer(int x, int y) {
                              ]%(#808080)[            Keyboard.enableRepeatEvents(true);
                              ]          //  this.fontRendererObj.drawString(I18n.format(this.inv.getInventoryName(), new Object[0), 8, 6, 4210752);
                              ]
                              %(#808080)[            int k;
                              ]
                              %(#808080)[            for (k = 0; k < this.buttonList.size(); ++k)
                              ]%(#808080)[            {
                              ]%(#808080)[                ((GuiButton)this.buttonList.get(k)).drawButton(this.mc, x, y);
                              ]%(#808080)[            }
                              ]
                                          // this.fontRendererObj.drawString(this.playerInv.hasCustomInventoryName() ? this.playerInv.getInventoryName() : I18n.format(this.playerInv.getInventoryName(), new Object[0), 8, this.ySize - 96 + 2, 4210752);
                              ]%(#808080)[        }*/
                              ]
                                 protected void actionPerformed(GuiButton button)
                                 {
                              
                                         this.mc.currentScreen.confirmClicked(true, 1)%(#cc7832)[;
                              ]            playerInv.closeInventory()%(#cc7832)[;
                              ]            EntityPlayer p1 = playerInv.player%(#cc7832)[;
                              ]        IChatComponent msg1 = IChatComponent.Serializer.*func_150699_a*("§4Erreur : la personne demandé n'existe pas. id : " + button.id)%(#cc7832)[;
                              ]
                              
                                     p1.addChatMessage(msg1)%(#cc7832)[;
                              ]            MinecraftServer mc1 = FMLServerHandler.*instance*().getServer()%(#cc7832)[;
                              ]            for (GameProfile g1 : mc1.func_152357_F()) {
                                             if (g.getText().equals(g1.getName())) {
                                                 EntityPlayer p = mc1.getEntityWorld().func_152378_a(g1.getId())%(#cc7832)[;
                              ]                    p.inventory.addItemStackToInventory(new ItemStack(GloryRP.*MenotesItem*, 1))%(#cc7832)[;
                              ]                } else {
                                                 IChatComponent msg = IChatComponent.Serializer.*func_150699_a*("§4Erreur : la personne demandé n'existe pas.")%(#cc7832)[;
                              ]
                              
                                                 p1.addChatMessage(msg)%(#cc7832)[;
                              ]                }
                                         }
                              
                                 }
                                 %(#629755)[*/**
                              *]%(#629755)[*     * Fired when a key is typed. This is the equivalent of KeyListener.keyTyped(KeyEvent e).
                              *]%(#629755)[*     */
                              *]    protected void keyTyped(char p_73869_1_, int p_73869_2_) {
                                     super.keyTyped(p_73869_1_, p_73869_2_
                              
                                     )%(#cc7832)[;
                              ]        this.g.textboxKeyTyped(p_73869_1_, p_73869_2_)%(#cc7832)[;
                              ]
                                          this.g.setFocused(!this.g.isFocused())%(#cc7832)[;
                              ]         %(#808080)[//   this.field_146308_f.setFocused(!this.field_146308_f.isFocused());
                              ]
                                 }
                                     %(#bbb529)[@Override
                              ]        protected void drawGuiContainerBackgroundLayer(float prt, int x, int y) {
                                      %(#808080)[//   super.drawGuiContainerBackgroundLayer(prt, x, y);
                              ]            GL11.*glColor4f*(1.0F, 1.0F, 1.0F, 1.0F)%(#cc7832)[;
                              ]            this.mc.getTextureManager().bindTexture(*texture*)%(#cc7832)[;
                              ]
                                         %(#808080)[// Centering GUI
                              ]            int k = (this.width - this.xSize) / 2%(#cc7832)[;
                              ]            int l = (this.height - this.ySize) / 2%(#cc7832)[;
                              ]
                                         %(#808080)[// Drawing the first part of the GUI (slots of the backpack)
                              ]            this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.rows * 18 + 17)%(#cc7832)[;
                              ]            %(#808080)[// And after the slots from the player's inventory
                              ]            this.drawTexturedModalRect(k, l + this.rows * 18 + 17, 0, 126, this.xSize, 96)%(#cc7832)[;
                              ]        }
                              
                                 public void updateScreen()
                                 {
                                     super.updateScreen()%(#cc7832)[;
                              ]        g.updateCursorCounter()%(#cc7832)[;
                              ]    }
                              
                                 %(#bbb529)[@Override
                              ]    protected void mouseClicked(int mouseX, int mouseY, int mouseButton)
                                 {
                                     super.mouseClicked(mouseX, mouseY, mouseButton)%(#cc7832)[;
                              ]        this.g.mouseClicked(mouseX, mouseY, mouseButton)%(#cc7832)[;
                              ]    }
                              
                                 public void drawScreen(int i, int j, float f)
                                 {
                                     super.drawScreen(i, j, f)%(#cc7832)[;
                              ]        GL11.*glDisable*(GL11.*GL_LIGHTING*)%(#cc7832)[;
                              ]        GL11.*glDisable*(GL11.*GL_BLEND*)%(#cc7832)[;
                              ]        g.drawTextBox()%(#cc7832)[;
                              ]
                                 }
                              
                                 }
                              ``` Merci de vos réponse.

                              Cordialement, le membre ayant le pseudo "ph1823"

                              Ma chaîne YouTube: https://www.youtube.com/c/ph1823
                              Mon Twitter : https://twitter.com/ph1823
                              Des jeux vidéo moin chers? Alors check ici : http://bit.ly/instaceph ou ici : http://bit.ly/g2aph

                              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 y a un npe sur une des classes de Minecraft. Ce qui est assez étrange comme il n’y a aucune référence à ton code.
                                Tu as modifié quelque chose dans le code de mc ?

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

                                  Je ne comprend pas pourquoi ce crash, mais pourquoi as tu laissé tout les trucs en rapport avec le texte field dans la méthode draw (il faut le définir UNE fois dans le méthode initGui et c’est bon).
                                  “MinecraftServer mc1 = FMLServerHandler.instance().getServer();” Essayé ça sur un serveur, le jeu crashera parce que le gui n’est que sur le client

                                  Si je vous ai aidé, n'oubliez pas d’être heureux, j'aiderai encore +

                                  AymericRed, moddeur expérimenté qui aide sur ce forum et qui peut accepter de faire un mod Forge rémunéré de temps en temps.

                                  Mes tutos : Table de craft, plugin NEI, plugin JEI, modifier l'overlay
                                  Je suis un membre apprécié et joueur, j'ai déjà obtenu 6 points de réputation.

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

                                    Peut-être que son crash est causé par l’installation de mod incompatible.

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

                                      @‘robin4002’:

                                      Il y a un npe sur une des classes de Minecraft. Ce qui est assez étrange comme il n’y a aucune référence à ton code.
                                      Tu as modifié quelque chose dans le code de mc ?

                                      Non, je n’ai pas modifié le code de mc 😕
                                      @‘AymericRed’:

                                      Je ne comprend pas pourquoi ce crash, mais pourquoi as tu laissé tout les trucs en rapport avec le texte field dans la méthode draw (il faut le définir UNE fois dans le méthode initGui et c’est bon).
                                      “MinecraftServer mc1 = FMLServerHandler.instance().getServer();” Essayé ça sur un serveur, le jeu crashera parce que le gui n’est que sur le client

                                      Effectivement, mais je le test bien sur un serveur et le serveur ne crash pas mais que le jeux, et j’enléve le text field da,s la méthoe draw
                                      @‘Plaigon’:

                                      Peut-être que son crash est causé par l’installation de mod incompatible.

                                      Hum bizzare car avant ce ne crashé pas 😕 En tout cas merci de vos réponse, je continue a cherché mais cane marche toujours pas.

                                      Cordialement, le membre ayant le pseudo "ph1823"

                                      Ma chaîne YouTube: https://www.youtube.com/c/ph1823
                                      Mon Twitter : https://twitter.com/ph1823
                                      Des jeux vidéo moin chers? Alors check ici : http://bit.ly/instaceph ou ici : http://bit.ly/g2aph

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

                                        Bah pour être sûr, enlève les tous et remets les. Sa ne te coûte rien…

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

                                          D’accord, merci mais ceci ne resoue pas le problème que quand on click sur validé , cela ne produit rien et aussi qu’on ne peux pas changé le text dans le Gui 😕

                                          Cordialement, le membre ayant le pseudo "ph1823"

                                          Ma chaîne YouTube: https://www.youtube.com/c/ph1823
                                          Mon Twitter : https://twitter.com/ph1823
                                          Des jeux vidéo moin chers? Alors check ici : http://bit.ly/instaceph ou ici : http://bit.ly/g2aph

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

                                            Pour le bouton, normal, tu lui as donné 32 comme id et dans la fonction onActionPerformed, tu vérifies si l’id est 0…

                                            Si je vous ai aidé, n'oubliez pas d’être heureux, j'aiderai encore +

                                            AymericRed, moddeur expérimenté qui aide sur ce forum et qui peut accepter de faire un mod Forge rémunéré de temps en temps.

                                            Mes tutos : Table de craft, plugin NEI, plugin JEI, modifier l'overlay
                                            Je suis un membre apprécié et joueur, j'ai déjà obtenu 6 points de réputation.

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

                                            MINECRAFT FORGE FRANCE © 2024

                                            Powered by NodeBB