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

                        Ben justement, je n’ai mis aucun if, donc ca ne risque pas d’être causer pas ca.

                        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 autan pour moi

                          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

                            Je me permet d’up le message car j’ai regardé dans la class GuiRepair, sauf que maintenant il n’y a plus le GuiTextField, et le button valide est en double, voici mon 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() {
                                   super.initGui()%(#cc7832)[;
                            ]        Keyboard.*enableRepeatEvents*(true)%(#cc7832)[;
                            ]
                                   FontRenderer f = this.mc.fontRenderer%(#cc7832)[;
                            ]        int i = (this.width - this.xSize) / 2%(#cc7832)[;
                            ]        int j = (this.height - this.ySize) / 2%(#cc7832)[;
                            ]
                            
                                   g = new GuiTextField(f, 55,230, 100,100)%(#cc7832)[;
                            ]        this.g = new GuiTextField(this.fontRendererObj, i + 62, j + 24, 103, 12)%(#cc7832)[;
                            ]        this.g.setTextColor(-1)%(#cc7832)[;
                            ]        this.g.setDisabledTextColour(-1)%(#cc7832)[;
                            ]        this.g.setEnableBackgroundDrawing(false)%(#cc7832)[;
                            ]        this.g.setMaxStringLength(40)%(#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)[;
                            ]
                            
                               }
                               %(#bbb529)[@Override
                            ]    public void onGuiClosed()
                               {
                                   super.onGuiClosed()%(#cc7832)[;
                            ]        Keyboard.*enableRepeatEvents*(false)%(#cc7832)[;
                            ]    }
                               %(#bbb529)[@Override
                            ]    protected void drawGuiContainerForegroundLayer(int x, int y) {
                               %(#808080)[//super.drawGuiContainerForegroundLayer(x, y);
                            ]
                                   GL11.*glEnable*(GL11.*GL_LIGHTING*)%(#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)[        }*/
                            ]    %(#bbb529)[@Override
                            ]    protected void actionPerformed(GuiButton button)
                               {
                            
                                       this.mc.currentScreen.confirmClicked(true, 1)%(#cc7832)[;
                            ]            playerInv.closeInventory()%(#cc7832)[;
                            ]            EntityPlayer p1 = playerInv.player%(#cc7832)[;
                            ]        p1.closeScreen()%(#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)[*     */
                            *]    %(#bbb529)[@Override
                            ]    protected void keyTyped(char p_73869_1_, int p_73869_2_) {
                                   super.keyTyped(p_73869_1_, p_73869_2_
                            
                                   )%(#cc7832)[;
                            ]        if(this.g.textboxKeyTyped(p_73869_1_, p_73869_2_)) {
                                       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();
                            ]            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
                            ]    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)[;
                            ]
                               }
                            
                               %(#bbb529)[@Override
                            ]    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)[;
                            ]
                            
                               }
                            
                            }
                            

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

                              g = new GuiTextField(f, 55,230, 100,100);
                              this.g = new GuiTextField(this.fontRendererObj, i + 62, j + 24, 103, 12);
                              

                              -> pourquoi le mettre 2 fois avec des valeurs différentes ?

                              
                              this.g.setTextColor(-1);
                              this.g.setDisabledTextColour(-1);
                              this.g.setEnableBackgroundDrawing(false);
                              

                              -> Pourquoi tout ça ?

                              @Override
                              protected void keyTyped(char p_73869_1_, int p_73869_2_) {
                              super.keyTyped(p_73869_1_, p_73869_2_
                              
                              );
                              if(this.g.textboxKeyTyped(p_73869_1_, p_73869_2_)) {
                              this.g.setFocused(!this.g.isFocused());
                              }
                              
                              // this.field_146308_f.setFocused(!this.field_146308_f.isFocused());
                              
                              }
                              

                              -> Tu as juste à mettre this.g.textboxKeyTyped(p_73869_1_, p_73869_2_)

                              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);
                              }
                              }
                              
                              }
                              });
                              
                              @Override
                              protected void actionPerformed(GuiButton button)
                              {
                              
                              this.mc.currentScreen.confirmClicked(true, 1);
                              playerInv.closeInventory();
                              EntityPlayer p1 = playerInv.player;
                              p1.closeScreen();
                              IChatComponent msg1 = IChatComponent.Serializer.func_150699_a("§4Erreur : la personne demandé n'existe pas. id : " + button.id);
                              
                              p1.addChatMessage(msg1);
                              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);
                              }
                              }
                              
                              }
                              

                              -> Tu as 2 fonctions qui sont appelées lorsque tu cliques
                              -> “this.mc.currentScreen.confirmClicked(true, 1);” -> pourquoi ?
                              -> “MinecraftServer mc1 = FMLServerHandler.instance().getServer();” -> tu essaies s’accéder au serveur côté client
                              -> “p.inventory.addItemStackToInventory(new ItemStack(GloryRP.MenotesItem, 1));” -> tu essaies d’ajouter un item côté client ce qui risque de créer un item fantôme
                              -> “} else {
                              IChatComponent msg = IChatComponent.Serializer.func_150699_a(”§4Erreur : la personne demandé n’existe pas.");

                              p1.addChatMessage(msg);
                              }" -> je pense que ceci devrait être appelé à la fin de la boucle sinon tu risques de spamer un peu

                              GL11.glDisable(GL11.GL_LIGHTING);
                              GL11.glDisable(GL11.GL_BLEND);
                              

                              -> pourquoi ?

                              PS : pense à faire du nettoyage car tu as beaucoup de commentaires

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

                                Bon déjà il manque

                                g.drawTextBox(); dans ta classe et dans la fonction drawSreen(), juste avant le super.drawScreen(); comme ça t’es sur qu’il sera au premier plan, pas après.

                                et on appelle pas une méthode g ça veux rien dire, m’enfin tu fais comme tu veux

                                Si je t'ai filé un coup de main n'oublie pas le + / -
                                Par contre évite les demandes d'aides en MP, tu sera sympa'

                                La JavaDoc c'est comme le PQ, ça sert à ce démerder tous seul. -Victor Hugo- 2017

                                Une superbe API pour animer vos super modèles CraftStudio dans Minecraft !

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

                                MINECRAFT FORGE FRANCE © 2024

                                Powered by NodeBB