MFF

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

    Récupérer les packets envoyés au joueur ?

    Planifier Épinglé Verrouillé Déplacé Résolu 1.7.x
    1.7.x
    38 Messages 6 Publieurs 8.2k 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.
    • DiabolicaTrixD Hors-ligne
      DiabolicaTrix Correcteurs Moddeurs confirmés
      dernière édition par

      En plus, de toute façon je ne cois pas que tu aies besoin de packet, je crois que tu vas chercher un peu trop loin.

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

        Les évènements livongHeal et LivingHurtEvent sont bien appelés côté serveur car je les ai utilisé dans mon HGVS, envoi ton code, il doit te manquer quelque chose

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

          Voilà mon code avec les events LivingHealEvent et LivingHurtEvent :

          
          package com.Toinou.LifeBarMod;
          
          import net.minecraft.entity.EntityLivingBase;
          import net.minecraft.entity.player.EntityPlayer;
          import net.minecraft.util.ChatComponentTranslation;
          import net.minecraftforge.event.entity.living.LivingHealEvent;
          import net.minecraftforge.event.entity.living.LivingHurtEvent;
          import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
          
          public class EventClass {
          
              @SubscribeEvent
              public void onPlayerHeal(LivingHealEvent e) {
          
                  if(e.entity instanceof EntityPlayer) {
          
                      EntityPlayer p = (EntityPlayer) e.entity;
          
                      float Vie = ((EntityLivingBase) p).getHealth();
                      String strVie = String.valueOf(Vie);
                      p.addChatMessage(new ChatComponentTranslation(strVie));
          
                  }
              }
          
              @SubscribeEvent
              public void onPlayerHurt(LivingHurtEvent e) {
          
                  if(e.entity instanceof EntityPlayer) {
          
                      EntityPlayer p = (EntityPlayer) e.entity;
          
                      float Vie = ((EntityLivingBase) p).getHealth();
                      String strVie = String.valueOf(Vie);
                      p.addChatMessage(new ChatComponentTranslation(strVie));
          
                  }
              }
          }
          
          

          Et je ne sais pas trop pourquoi, ça ne marche qu’en solo. Et puis, ce qui est embêtant avec ces deux events, c’est qu’ils me retournent la vie avant de prendre les dégâts ou que la vie remonte.

          J’avais essayé de récupérer la vie avec un PlayerTickEvent, ça marchait très bien en solo et sur les serveurs vanilla, mais sur les serveurs de mini-jeux par exemple, il me renvoyait des données très bizarres.

          1 réponse Dernière réponse Répondre Citer 0
          • BrokenSwingB Hors-ligne
            BrokenSwing Moddeurs confirmés Rédacteurs
            dernière édition par

            Ces events te retournent la vie avant sa modification car ils sont ‘annulable’ en faisant un ```java
            event.setCanceled(true)

            
            Pour les LivingHurtEvent :
            
            ```java
            
            if(e.entity instanceof EntityPlayer)
            {
            EntityPlayer player = (EntityPlayer)e.entity;
            float vie = player.getHealth() - e.ammount;
            }
            
            

            Et pour le LivingHealEvent:

            
            if(e.entity instanceof EntityPlayer)
            {
            EntityPlayer player = (EntityPlayer)e.entity;
            float vie = player.getHealth() + e.amount;
            }
            
            

            Tiens, amount ne s’écrit pas pareil (en 1.8 ent tout cas) selon l’event.

            1 réponse Dernière réponse Répondre Citer 1
            • T Hors-ligne
              Toinou9120
              dernière édition par

              @‘bodri’:

              Ces events te retournent la vie avant sa modification car ils sont ‘annulable’ en faisant un ```java
              event.setCanceled(true)

              
              Pour les LivingHurtEvent :
              
              ```java
              
              if(e.entity instanceof EntityPlayer)
              {
              EntityPlayer player = (EntityPlayer)e.entity;
              float vie = player.getHealth() - e.ammount;
              }
              
              

              Et pour le LivingHealEvent:

              
              if(e.entity instanceof EntityPlayer)
              {
              EntityPlayer player = (EntityPlayer)e.entity;
              float vie = player.getHealth() + e.amount;
              }
              
              

              Tiens, amount ne s’écrit pas pareil (en 1.8 ent tout cas) selon l’event.

              Ah d’accord merci pour les conseils. Et du coup, comme c’est un event qui peuvent être cancel, il ne marche pas sur serveur ( sinon ca serait un peu cheaté 😛 ). Personne connaît un moyen simple de récupérer la vie du joueur sur serveur ?

              1 réponse Dernière réponse Répondre Citer 0
              • BrokenSwingB Hors-ligne
                BrokenSwing Moddeurs confirmés Rédacteurs
                dernière édition par

                Si j’ai bien compris tu cherche à faire un mod client seulement qui récupère la vie des joueurs, c’est cela ?

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

                  Oui, c’est ça, je veux récupérer la vie du joueur quand elle change.

                  1 réponse Dernière réponse Répondre Citer 0
                  • BrokenSwingB Hors-ligne
                    BrokenSwing Moddeurs confirmés Rédacteurs
                    dernière édition par

                    Essai ça, peut être :

                    
                    public class EventClientListener { //Enregistré côté client seulement
                    
                    @SubscribeEvent
                    public void onRenderGameOverlay(RenderGameOverlayEvent e) //J'ai pris cet event parce que c'est un event client et qu'il est exécuter sans aucune action
                    {
                    Ordering ordering = Ordering.from(new PlayerComparator()); //Pour trier les joueurs, c'est le système de minecraft
                    NetHandlerPlayClient nethandler = Minecraft.getMinecraft().thePlayer.sendQueue;
                    List list = ordering.sortedCopy(nethandler.func_175106_d());
                    Iterator iterator = list.iterator();
                    
                    while(iterator.hasNext())
                    {
                    NetworkPlayerInfo playerinfo = (NetworkPlayerInfo)iterator.next();
                    EntityPlayer player = Minecraft.getMinecraft().theWorld.getPlayerEntityByUUID(playerinfo.getGameProfile().getId());
                    Minecraft.getMinecraft().thePlayer.sendChatMessage(player.getName() + " a " + player.getHealth() + " demi-coeurs");
                    }
                    
                    }
                    
                    @SideOnly(Side.CLIENT)
                    static class PlayerComparator implements Comparator // trie un fonction des teams et des modes de jeu (je crois)
                    {
                    private PlayerComparator() {}
                    
                    public int comparation(NetworkPlayerInfo p_178952_1_, NetworkPlayerInfo p_178952_2_)
                    {
                    ScorePlayerTeam scoreplayerteam = p_178952_1_.getPlayerTeam();
                    ScorePlayerTeam scoreplayerteam1 = p_178952_2_.getPlayerTeam();
                    return ComparisonChain.start().compareTrueFirst(p_178952_1_.getGameType() != WorldSettings.GameType.SPECTATOR, p_178952_2_.getGameType() != WorldSettings.GameType.SPECTATOR).compare(scoreplayerteam != null ? scoreplayerteam.getRegisteredName() : "", scoreplayerteam1 != null ? scoreplayerteam1.getRegisteredName() : "").compare(p_178952_1_.getGameProfile().getName(), p_178952_2_.getGameProfile().getName()).result();
                    }
                    
                    public int compare(Object p_compare_1_, Object p_compare_2_)
                    {
                    return comparation((NetworkPlayerInfo)p_compare_1_, (NetworkPlayerInfo)p_compare_2_);
                    }
                    }
                    }
                    
                    

                    Après faut que t’arrive à afficher seulement lorsque les joueur prend un dégâts ou gagne de la vie, pour le comparator tu peux juste faire :

                    
                    Ordering ordering = Ordering.from(new Comparator() {
                    
                    @Override
                    public int compare(Object o1, Object o2) {
                    return 0;
                    }
                    });
                    
                    

                    Mais ça triera rien du tout normalement.

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

                      Je comprends pas tout mais bon x) je vais tester ça tout de suite 🙂

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

                        Bon, déjà, j’ai modifié le fait que ça envoie un message dans le chat et j’ai mis que ça m’envoyai un message. Ca marche parfaitement en solo et sur les serveurs vanilla mais sur les serveurs bukkit, ca crash des que je me co 😕

                        Voici le rapport de crash si ça peut intéréssé :

                        
                        –-- Minecraft Crash Report ----
                        
                        WARNING: coremods are present:
                        Contact their authors BEFORE contacting forge
                        
                        // Don't be sad. I'll do better next time, I promise!
                        
                        Time: 04/10/15 14:11
                        Description: Unexpected error
                        
                        java.lang.NullPointerException: Unexpected error
                            at com.Toinou.LifeBarMod.EventClass.onRenderGameOverlay(EventClass.java:77)
                            at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_6_EventClass_onRenderGameOverlay_RenderGameOverlayEvent.invoke(.dynamic)
                            at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:55)
                            at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:138)
                            at net.minecraftforge.client.GuiIngameForge.pre(GuiIngameForge.java:854)
                            at net.minecraftforge.client.GuiIngameForge.func_175180_a(GuiIngameForge.java:108)
                            at net.minecraft.client.renderer.EntityRenderer.func_78480_b(EntityRenderer.java:1266)
                            at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:1055)
                            at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:345)
                            at net.minecraft.client.main.Main.main(SourceFile:120)
                            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 com.Toinou.LifeBarMod.EventClass.onRenderGameOverlay(EventClass.java:77)
                            at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_6_EventClass_onRenderGameOverlay_RenderGameOverlayEvent.invoke(.dynamic)
                            at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:55)
                            at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:138)
                            at net.minecraftforge.client.GuiIngameForge.pre(GuiIngameForge.java:854)
                            at net.minecraftforge.client.GuiIngameForge.func_175180_a(GuiIngameForge.java:108)
                        
                        -- Affected level --
                        Details:
                            Level name: MpServer
                            All players: 1 total; [EntityPlayerSP['Toinou9120'/1643, l='MpServer', x=8,50, y=65,00, z=8,50]]
                            Chunk stats: MultiplayerChunkCache: 1, 1
                            Level seed: 0
                            Level generator: ID 01 - flat, ver 0\. Features enabled: false
                            Level generator options:
                            Level spawn location: -26,00,50,00,89,00 - World: (-26,50,89), Chunk: (at 6,3,9 in -2,5; contains blocks -32,0,80 to -17,255,95), Region: (-1,0; contains chunks -32,0 to -1,31, blocks -512,0,0 to -1,255,511)
                            Level time: 0 game time, 0 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: survival (ID 0). Hardcore: false. Cheats: false
                            Forced entities: 1 total; [EntityPlayerSP['Toinou9120'/1643, l='MpServer', x=8,50, y=65,00, z=8,50]]
                            Retry entities: 0 total; []
                            Server brand: BungeeCord (git:BungeeCord-Bootstrap:1.8-SNAPSHOT:fa828eb:unknown) <- Spigot
                            Server type: Non-integrated multiplayer server
                        Stacktrace:
                            at net.minecraft.client.multiplayer.WorldClient.func_72914_a(WorldClient.java:407)
                            at net.minecraft.client.Minecraft.func_71396_d(Minecraft.java:2502)
                            at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:374)
                            at net.minecraft.client.main.Main.main(SourceFile:120)
                            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.8
                            Operating System: Windows 7 (amd64) version 6.1
                            Java Version: 1.7.0_75, Oracle Corporation
                            Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
                            Memory: 116998584 bytes (111 MB) / 384229376 bytes (366 MB) up to 2134114304 bytes (2035 MB)
                            JVM Flags: 6 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump -Xmx2G -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:-UseAdaptiveSizePolicy -Xmn128M
                            IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
                            FML: MCP v9.10 FML v8.0.99.99 Minecraft Forge 11.14.3.1450 Optifine OptiFine_1.8_HD_U_D5 4 mods loaded, 4 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{8.0.99.99} [Forge Mod Loader] (forge-1.8-11.14.3.1450.jar)
                            UCHIJA    Forge{11.14.3.1450} [Minecraft Forge] (forge-1.8-11.14.3.1450.jar)
                            UCHIJA    LBM{1.0} [LifeBarMod] (LifeBar Mod 16.jar)
                            Loaded coremods (and transformers):
                            GL info: ' Vendor: 'ATI Technologies Inc.' Version: '4.5.13399 Compatibility Profile Context 15.200.1062.1004' Renderer: 'AMD Radeon HD 6450'
                            Launched Version: 1.8-Forge11.14.3.1450
                            LWJGL: 2.9.1
                            OpenGL: AMD Radeon HD 6450 GL version 4.5.13399 Compatibility Profile Context 15.200.1062.1004, ATI Technologies Inc.
                            GL Caps: Using GL 1.3 multitexturing.
                        Using GL 1.3 texture combiners.
                        Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported.
                        Shaders are available because OpenGL 2.1 is supported.
                        VBOs are available because OpenGL 1.5 is supported.
                        
                            Using VBOs: Yes
                            Is Modded: Definitely; Client brand changed to 'fml,forge'
                            Type: Client (map_client.txt)
                            Resource Packs: [faithful32pack.zip, OCD pack 1.8 [Perso].zip, thebaum64_sky.zip]
                            Current Language: §eEnglish (§bColor§e)
                            Profiler Position: N/A (disabled)
                        
                        
                        1 réponse Dernière réponse Répondre Citer 0
                        • BrokenSwingB Hors-ligne
                          BrokenSwing Moddeurs confirmés Rédacteurs
                          dernière édition par

                          Ta classe event ? stp

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

                            Voilà :

                            
                            package com.Toinou.LifeBarMod;
                            
                            import java.util.Comparator;
                            import java.util.Iterator;
                            import java.util.List;
                            
                            import net.minecraft.client.Minecraft;
                            import net.minecraft.client.network.NetHandlerPlayClient;
                            import net.minecraft.client.network.NetworkPlayerInfo;
                            import net.minecraft.entity.player.EntityPlayer;
                            import net.minecraft.scoreboard.ScorePlayerTeam;
                            import net.minecraft.util.ChatComponentTranslation;
                            import net.minecraft.world.WorldSettings;
                            import net.minecraftforge.client.event.RenderGameOverlayEvent;
                            import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
                            import net.minecraftforge.fml.relauncher.Side;
                            import net.minecraftforge.fml.relauncher.SideOnly;
                            
                            import com.google.common.collect.ComparisonChain;
                            import com.google.common.collect.Ordering;
                            
                            public class EventClass {
                            
                                @SubscribeEvent
                                public void onRenderGameOverlay(RenderGameOverlayEvent e) //J'ai pris cet event parce que c'est un event client et qu'il est exécuter sans aucune action
                                {
                                    Ordering ordering = Ordering.from(new PlayerComparator()); //Pour trier les joueurs, c'est le système de minecraft
                                    NetHandlerPlayClient nethandler = Minecraft.getMinecraft().thePlayer.sendQueue;
                                    List list = ordering.sortedCopy(nethandler.func_175106_d());
                                    Iterator iterator = list.iterator();
                            
                                    while(iterator.hasNext())
                                    {
                                        NetworkPlayerInfo playerinfo = (NetworkPlayerInfo)iterator.next();
                                        EntityPlayer player = Minecraft.getMinecraft().theWorld.getPlayerEntityByUUID(playerinfo.getGameProfile().getId());
                                        float Vie = player.getHealth();
                                        String strVie = String.valueOf(Vie);
                                        Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentTranslation(strVie));
                                    }
                            
                                }
                            
                                    @SideOnly(Side.CLIENT)
                                    static class PlayerComparator implements Comparator // trie un fonction des teams et des modes de jeu (je crois)
                                    {
                                        private PlayerComparator() {}
                            
                                        public int comparation(NetworkPlayerInfo p_178952_1_, NetworkPlayerInfo p_178952_2_)
                                        {
                                            ScorePlayerTeam scoreplayerteam = p_178952_1_.getPlayerTeam();
                                            ScorePlayerTeam scoreplayerteam1 = p_178952_2_.getPlayerTeam();
                                            return ComparisonChain.start().compareTrueFirst(p_178952_1_.getGameType() != WorldSettings.GameType.SPECTATOR, p_178952_2_.getGameType() != WorldSettings.GameType.SPECTATOR).compare(scoreplayerteam != null ? scoreplayerteam.getRegisteredName() : "", scoreplayerteam1 != null ? scoreplayerteam1.getRegisteredName() : "").compare(p_178952_1_.getGameProfile().getName(), p_178952_2_.getGameProfile().getName()).result();
                                        }
                            
                                        public int compare(Object p_compare_1_, Object p_compare_2_)
                                        {
                                            return comparation((NetworkPlayerInfo)p_compare_1_, (NetworkPlayerInfo)p_compare_2_);
                                        }
                                    }
                            
                            }
                            
                            
                            1 réponse Dernière réponse Répondre Citer 0
                            • BrokenSwingB Hors-ligne
                              BrokenSwing Moddeurs confirmés Rédacteurs
                              dernière édition par

                              Tu est sûr d’avoir mis toute ta classe ?

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

                                Ouais, sûr

                                1 réponse Dernière réponse Répondre Citer 0
                                • BrokenSwingB Hors-ligne
                                  BrokenSwing Moddeurs confirmés Rédacteurs
                                  dernière édition par

                                  Le crash report informe d’un NPE ligne 77 mais il n’y a même pas 77 lignes dans ta classe 😕

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

                                    Ah c’est parce que j’avais des anciens tests que j’ai mis en commentaire et du coup je les ai pas mis dans ce que j’ai copié collé, j’avais pas pensé à ça désolé 😕
                                    Donc voici ma classe avec les commentaires compris dedans :

                                    
                                    package com.Toinou.LifeBarMod;
                                    
                                    import java.util.Comparator;
                                    import java.util.Iterator;
                                    import java.util.List;
                                    
                                    import net.minecraft.client.Minecraft;
                                    import net.minecraft.client.network.NetHandlerPlayClient;
                                    import net.minecraft.client.network.NetworkPlayerInfo;
                                    import net.minecraft.entity.player.EntityPlayer;
                                    import net.minecraft.scoreboard.ScorePlayerTeam;
                                    import net.minecraft.util.ChatComponentTranslation;
                                    import net.minecraft.world.WorldSettings;
                                    import net.minecraftforge.client.event.RenderGameOverlayEvent;
                                    import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
                                    import net.minecraftforge.fml.relauncher.Side;
                                    import net.minecraftforge.fml.relauncher.SideOnly;
                                    
                                    import com.google.common.collect.ComparisonChain;
                                    import com.google.common.collect.Ordering;
                                    
                                    public class EventClass {
                                    
                                        /*@SubscribeEvent
                                        public void onPlayerHeal(LivingHealEvent e) {
                                    
                                            if(e.entity instanceof EntityPlayer) {
                                    
                                                EntityPlayer p = (EntityPlayer) e.entity;
                                    
                                                float Vie = ((EntityLivingBase) p).getHealth();
                                                String strVie = String.valueOf(Vie);
                                                p.addChatMessage(new ChatComponentTranslation(strVie));
                                    
                                            }
                                        }
                                    
                                        @SubscribeEvent
                                        public void onPlayerHurt(LivingHurtEvent e) {
                                    
                                            if(e.entity instanceof EntityPlayer) {
                                    
                                                EntityPlayer p = (EntityPlayer) e.entity;
                                    
                                                float Vie = ((EntityLivingBase) p).getHealth();
                                                String strVie = String.valueOf(Vie);
                                                p.addChatMessage(new ChatComponentTranslation(strVie));
                                    
                                            }
                                        }
                                    
                                        @SubscribeEvent
                                        public void onPlayerTickEvent(PlayerTickEvent e) {
                                    
                                            String strVie = String.valueOf(Vie);
                                            String strAncVie = String.valueOf(AncienneVie);
                                            EntityPlayer p = e.player;
                                            Vie = p.getHealth();
                                            String strVie = String.valueOf(Vie);
                                            p.addChatMessage(new ChatComponentTranslation(strVie));
                                    
                                        }*/
                                    
                                        @SubscribeEvent
                                        public void onRenderGameOverlay(RenderGameOverlayEvent e) //J'ai pris cet event parce que c'est un event client et qu'il est exécuter sans aucune action
                                        {
                                            Ordering ordering = Ordering.from(new PlayerComparator()); //Pour trier les joueurs, c'est le système de minecraft
                                            NetHandlerPlayClient nethandler = Minecraft.getMinecraft().thePlayer.sendQueue;
                                            List list = ordering.sortedCopy(nethandler.func_175106_d());
                                            Iterator iterator = list.iterator();
                                    
                                            while(iterator.hasNext())
                                            {
                                                NetworkPlayerInfo playerinfo = (NetworkPlayerInfo)iterator.next();
                                                EntityPlayer player = Minecraft.getMinecraft().theWorld.getPlayerEntityByUUID(playerinfo.getGameProfile().getId());
                                                float Vie = player.getHealth();
                                                String strVie = String.valueOf(Vie);
                                                Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentTranslation(strVie));
                                            }
                                    
                                        }
                                    
                                            @SideOnly(Side.CLIENT)
                                            static class PlayerComparator implements Comparator // trie un fonction des teams et des modes de jeu (je crois)
                                            {
                                                private PlayerComparator() {}
                                    
                                                public int comparation(NetworkPlayerInfo p_178952_1_, NetworkPlayerInfo p_178952_2_)
                                                {
                                                    ScorePlayerTeam scoreplayerteam = p_178952_1_.getPlayerTeam();
                                                    ScorePlayerTeam scoreplayerteam1 = p_178952_2_.getPlayerTeam();
                                                    return ComparisonChain.start().compareTrueFirst(p_178952_1_.getGameType() != WorldSettings.GameType.SPECTATOR, p_178952_2_.getGameType() != WorldSettings.GameType.SPECTATOR).compare(scoreplayerteam != null ? scoreplayerteam.getRegisteredName() : "", scoreplayerteam1 != null ? scoreplayerteam1.getRegisteredName() : "").compare(p_178952_1_.getGameProfile().getName(), p_178952_2_.getGameProfile().getName()).result();
                                                }
                                    
                                                public int compare(Object p_compare_1_, Object p_compare_2_)
                                                {
                                                    return comparation((NetworkPlayerInfo)p_compare_1_, (NetworkPlayerInfo)p_compare_2_);
                                                }
                                            }
                                    
                                    }
                                    
                                    

                                    EDIT : Il y a quelque chose de bizarre, dans Eclipse, la ligne 77 c’est " float Vie = player.getHealth() " et la, la ligne 77, c’est celle d’au dessus

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

                                      Il y a quelque chose de bizarre, dans Eclipse, la ligne 77 c’est " float Vie = player.getHealth() " et la, la ligne 77, c’est celle d’au dessus

                                      1 réponse Dernière réponse Répondre Citer 0
                                      • BrokenSwingB Hors-ligne
                                        BrokenSwing Moddeurs confirmés Rédacteurs
                                        dernière édition par

                                        Essai de remplacer la ligne 77 par :

                                        
                                        EntityPlayer player = Minecraft.getMinecraft().theWorld.getPlayerEntityByName(playerinfo.getGameProfile().getName());
                                        
                                        
                                        1 réponse Dernière réponse Répondre Citer 0
                                        • T Hors-ligne
                                          Toinou9120
                                          dernière édition par

                                          Ca crash toujours 😕
                                          Mais je ne sais pas si tu as vu mais j’ai remarqué que dans Eclipse la ligne 77 c’est " float Vie = player.getHealth() " c’est quand je le copie, il rajoute une ligne au début ce qui décale les lignes par rapport à Eclipse.

                                          Le crash report :

                                          
                                          –-- Minecraft Crash Report ----
                                          
                                          WARNING: coremods are present:
                                          Contact their authors BEFORE contacting forge
                                          
                                          // Who set us up the TNT?
                                          
                                          Time: 04/10/15 14:51
                                          Description: Unexpected error
                                          
                                          java.lang.NullPointerException: Unexpected error
                                              at com.Toinou.LifeBarMod.EventClass.onRenderGameOverlay(EventClass.java:77)
                                              at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_6_EventClass_onRenderGameOverlay_RenderGameOverlayEvent.invoke(.dynamic)
                                              at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:55)
                                              at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:138)
                                              at net.minecraftforge.client.GuiIngameForge.pre(GuiIngameForge.java:854)
                                              at net.minecraftforge.client.GuiIngameForge.func_175180_a(GuiIngameForge.java:108)
                                              at net.minecraft.client.renderer.EntityRenderer.func_78480_b(EntityRenderer.java:1266)
                                              at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:1055)
                                              at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:345)
                                              at net.minecraft.client.main.Main.main(SourceFile:120)
                                              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 com.Toinou.LifeBarMod.EventClass.onRenderGameOverlay(EventClass.java:77)
                                              at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_6_EventClass_onRenderGameOverlay_RenderGameOverlayEvent.invoke(.dynamic)
                                              at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:55)
                                              at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:138)
                                              at net.minecraftforge.client.GuiIngameForge.pre(GuiIngameForge.java:854)
                                              at net.minecraftforge.client.GuiIngameForge.func_175180_a(GuiIngameForge.java:108)
                                          
                                          -- Affected level --
                                          Details:
                                              Level name: MpServer
                                              All players: 1 total; [EntityPlayerSP['Toinou9120'/811898, l='MpServer', x=-11,50, y=92,00, z=-19,50]]
                                              Chunk stats: MultiplayerChunkCache: 0, 0
                                              Level seed: 0
                                              Level generator: ID 01 - flat, ver 0\. Features enabled: false
                                              Level generator options:
                                              Level spawn location: -1397,00,4,00,593,00 - World: (-1397,4,593), Chunk: (at 11,0,1 in -88,37; contains blocks -1408,0,592 to -1393,255,607), Region: (-3,1; contains chunks -96,32 to -65,63, blocks -1536,0,512 to -1025,255,1023)
                                              Level time: 0 game time, 0 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: survival (ID 0). Hardcore: false. Cheats: false
                                              Forced entities: 2 total; [EntityPlayerSP['Toinou9120'/811898, l='MpServer', x=-11,50, y=92,00, z=-19,50], EntityWither['§e§lPlaying §f§lSKYWARS§e§l on §f§lMC.HYPIXEL.NET'/-1234, l='MpServer', x=-1393,50, y=-1,00, z=628,50]]
                                              Retry entities: 0 total; []
                                              Server brand: BungeeCord (Hypixel) <- Spigot
                                              Server type: Non-integrated multiplayer server
                                          Stacktrace:
                                              at net.minecraft.client.multiplayer.WorldClient.func_72914_a(WorldClient.java:407)
                                              at net.minecraft.client.Minecraft.func_71396_d(Minecraft.java:2502)
                                              at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:374)
                                              at net.minecraft.client.main.Main.main(SourceFile:120)
                                              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.8
                                              Operating System: Windows 7 (amd64) version 6.1
                                              Java Version: 1.7.0_75, Oracle Corporation
                                              Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
                                              Memory: 253641320 bytes (241 MB) / 405528576 bytes (386 MB) up to 2134114304 bytes (2035 MB)
                                              JVM Flags: 6 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump -Xmx2G -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:-UseAdaptiveSizePolicy -Xmn128M
                                              IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
                                              FML: MCP v9.10 FML v8.0.99.99 Minecraft Forge 11.14.3.1450 Optifine OptiFine_1.8_HD_U_D5 4 mods loaded, 4 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{8.0.99.99} [Forge Mod Loader] (forge-1.8-11.14.3.1450.jar)
                                              UCHIJA    Forge{11.14.3.1450} [Minecraft Forge] (forge-1.8-11.14.3.1450.jar)
                                              UCHIJA    LBM{1.0} [LifeBarMod] (LifeBar Mod 18.jar)
                                              Loaded coremods (and transformers):
                                              GL info: ' Vendor: 'ATI Technologies Inc.' Version: '4.5.13399 Compatibility Profile Context 15.200.1062.1004' Renderer: 'AMD Radeon HD 6450'
                                              Launched Version: 1.8-Forge11.14.3.1450
                                              LWJGL: 2.9.1
                                              OpenGL: AMD Radeon HD 6450 GL version 4.5.13399 Compatibility Profile Context 15.200.1062.1004, ATI Technologies Inc.
                                              GL Caps: Using GL 1.3 multitexturing.
                                          Using GL 1.3 texture combiners.
                                          Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported.
                                          Shaders are available because OpenGL 2.1 is supported.
                                          VBOs are available because OpenGL 1.5 is supported.
                                          
                                              Using VBOs: Yes
                                              Is Modded: Definitely; Client brand changed to 'fml,forge'
                                              Type: Client (map_client.txt)
                                              Resource Packs: [faithful32pack.zip, OCD pack 1.8 [Perso].zip, thebaum64_sky.zip]
                                              Current Language: §eEnglish (§bColor§e)
                                              Profiler Position: N/A (disabled)
                                          
                                          
                                          1 réponse Dernière réponse Répondre Citer 0
                                          • DeletedD Hors-ligne
                                            Deleted
                                            dernière édition par

                                            Oui et ? Eclipse s’en fiche de savoir si telle ou telle ligne et plus ou moins décalée par-rapport à telle ou telle autre ligne 🙂

                                            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