MFF

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

    Problème avec les events.

    Planifier Épinglé Verrouillé Déplacé Résolu Anciennes versions
    1.6.4
    20 Messages 4 Publieurs 4.9k 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.
    • ÜberfapÜ Hors-ligne
      Überfap
      dernière édition par

      Gugu42 à raison, de plus j’ai suivi le même tutoriel, et il est parfaitement fonctionnel en 1.6

      Si je t'ai aidé, n'hésites pas à mettre un point de réputation positif !
      Si tu m'as aidé, je n'hésiterais pas à t'en donner à mon tour !

      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

        C’est encore fonctionnel en 1.6, je pense que c’est un problème avec le tag nbt, enlève l’espace.
        Même chose pour le registerExtendedProperties évite les espaces dans les string.

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

          J’ai enlevé les espaces mais sa ne change rien.

          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

            Envoie le crash report.

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

              Il n’y a pas de crash justement c’est ça que je trouve bizarre.
              Rien de particulier ne s’affiche dans la console.

              
              2014-01-02 19:39:02 [Infos] [Minecraft-Server] Preparing start region for level 0
              2014-01-02 19:39:04 [Infos] [Minecraft-Server] Preparing spawn area: 25%
              2014-01-02 19:39:07 [Infos] [Minecraft-Server] Preparing spawn area: 72%
              2014-01-02 19:39:08 [Infos] [STDOUT] loading single player
              2014-01-02 19:39:08 [Infos] [Minecraft-Server] Player505[/127.0.0.1:0] logged in with entity id 25 at (-732.1298898366373, 4.0, 650.2893601972046)
              2014-01-02 19:39:08 [Infos] [Minecraft-Server] Player505 joined the game
              2014-01-02 19:39:09 [Infos] [STDOUT] Setting up custom skins
              2014-01-02 19:39:16 [Infos] [Minecraft-Server] Saving and pausing game…
              2014-01-02 19:39:16 [Infos] [Minecraft-Server] Saving chunks for level 'Mod terracraft'/Overworld
              2014-01-02 19:39:17 [Infos] [Minecraft-Server] Saving chunks for level 'Mod terracraft'/Nether
              2014-01-02 19:39:17 [Infos] [Minecraft-Server] Saving chunks for level 'Mod terracraft'/The End
              2014-01-02 19:39:49 [Infos] [Minecraft-Server] Saving and pausing game…
              2014-01-02 19:39:49 [Infos] [Minecraft-Server] Saving chunks for level 'Mod terracraft'/Overworld
              2014-01-02 19:39:49 [Infos] [Minecraft-Server] Saving chunks for level 'Mod terracraft'/Nether
              2014-01-02 19:39:49 [Infos] [Minecraft-Server] Saving chunks for level 'Mod terracraft'/The End
              2014-01-02 19:39:49 [Infos] [Minecraft-Server] Stopping server
              2014-01-02 19:39:49 [Infos] [Minecraft-Server] Saving players
              2014-01-02 19:39:49 [Infos] [Minecraft-Server] Player505 left the game
              2014-01-02 19:39:49 [Infos] [Minecraft-Server] Saving worlds
              2014-01-02 19:39:49 [Infos] [Minecraft-Server] Saving chunks for level 'Mod terracraft'/Overworld
              2014-01-02 19:39:49 [Infos] [Minecraft-Server] Saving chunks for level 'Mod terracraft'/Nether
              2014-01-02 19:39:49 [Infos] [Minecraft-Server] Saving chunks for level 'Mod terracraft'/The End
              2014-01-02 19:39:50 [Infos] [ForgeModLoader] Unloading dimension 0
              2014-01-02 19:39:50 [Infos] [ForgeModLoader] Unloading dimension -1
              2014-01-02 19:39:50 [Infos] [ForgeModLoader] Unloading dimension 1
              2014-01-02 19:39:52 [Infos] [Minecraft-Client] Stopping!
              2014-01-02 19:39:52 [Infos] [STDOUT]
              2014-01-02 19:39:52 [Infos] [STDOUT] SoundSystem shutting down…
              2014-01-02 19:39:53 [Infos] [STDOUT] Author: Paul Lamb, www.paulscode.com
              2014-01-02 19:39:53 [Infos] [STDOUT]
              

              J’ai tué un mouton entre les 2 pauses de jeu.

              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

                Ton event death est foireux.

                @ForgeSubscribe
                public void death(LivingDeathEvent event)
                {
                Entity source = event.source.getEntity();
                if (source != null && source instanceof EntityPlayer)
                {
                IExtendedEntityProperties prop = event.entity.getExtendedProperties("Custom Player");
                int mana = ((CustomPlayer)prop).getMana()+1;
                System.out.println("Mana de "+source.getEntityName()+"= "+mana);
                ((CustomPlayer)prop).setMana(mana);
                }
                }
                
                1 réponse Dernière réponse Répondre Citer 0
                • tybauT Hors-ligne
                  tybau
                  dernière édition par

                  Maintenant le jeu crash:

                  –-- Minecraft Crash Report ----
                  // Why is it breaking :(
                  
                  Time: 02/01/14 20:52
                  Description: Ticking memory connection
                  
                  java.lang.NullPointerException
                  at noob.common.AddCustomPlayerProperties.death(AddCustomPlayerProperties.java:29)
                  at net.minecraftforge.event.ASMEventHandler_4_AddCustomPlayerProperties_death_LivingDeathEvent.invoke(.dynamic)
                  at net.minecraftforge.event.ASMEventHandler.invoke(ASMEventHandler.java:39)
                  at net.minecraftforge.event.EventBus.post(EventBus.java:108)
                  at net.minecraftforge.common.ForgeHooks.onLivingDeath(ForgeHooks.java:342)
                  at net.minecraft.entity.EntityLivingBase.onDeath(EntityLivingBase.java:988)
                  at net.minecraft.entity.EntityLivingBase.attackEntityFrom(EntityLivingBase.java:951)
                  at net.minecraft.entity.passive.EntityAnimal.attackEntityFrom(EntityAnimal.java:206)
                  at net.minecraft.entity.player.EntityPlayer.attackTargetEntityWithCurrentItem(EntityPlayer.java:1367)
                  at net.minecraft.network.NetServerHandler.handleUseEntity(NetServerHandler.java:854)
                  at net.minecraft.network.packet.Packet7UseEntity.processPacket(Packet7UseEntity.java:57)
                  at net.minecraft.network.MemoryConnection.processReadPackets(MemoryConnection.java:89)
                  at net.minecraft.network.NetServerHandler.networkTick(NetServerHandler.java:141)
                  at net.minecraft.network.NetworkListenThread.networkTick(NetworkListenThread.java:54)
                  at net.minecraft.server.integrated.IntegratedServerListenThread.networkTick(IntegratedServerListenThread.java:109)
                  at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:691)
                  at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:587)
                  at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:129)
                  at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:484)
                  at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16)
                  
                  A detailed walkthrough of the error, its code path and all known details is as follows:
                  ---------------------------------------------------------------------------------------
                  
                  -- Head --
                  Stacktrace:
                  at noob.common.AddCustomPlayerProperties.death(AddCustomPlayerProperties.java:29)
                  at net.minecraftforge.event.ASMEventHandler_4_AddCustomPlayerProperties_death_LivingDeathEvent.invoke(.dynamic)
                  at net.minecraftforge.event.ASMEventHandler.invoke(ASMEventHandler.java:39)
                  at net.minecraftforge.event.EventBus.post(EventBus.java:108)
                  at net.minecraftforge.common.ForgeHooks.onLivingDeath(ForgeHooks.java:342)
                  at net.minecraft.entity.EntityLivingBase.onDeath(EntityLivingBase.java:988)
                  at net.minecraft.entity.EntityLivingBase.attackEntityFrom(EntityLivingBase.java:951)
                  at net.minecraft.entity.passive.EntityAnimal.attackEntityFrom(EntityAnimal.java:206)
                  at net.minecraft.entity.player.EntityPlayer.attackTargetEntityWithCurrentItem(EntityPlayer.java:1367)
                  at net.minecraft.network.NetServerHandler.handleUseEntity(NetServerHandler.java:854)
                  at net.minecraft.network.packet.Packet7UseEntity.processPacket(Packet7UseEntity.java:57)
                  at net.minecraft.network.MemoryConnection.processReadPackets(MemoryConnection.java:89)
                  at net.minecraft.network.NetServerHandler.networkTick(NetServerHandler.java:141)
                  
                  -- Ticking connection --
                  Details:
                  Connection: net.minecraft.network.NetServerHandler@160f199
                  Stacktrace:
                  at net.minecraft.network.NetworkListenThread.networkTick(NetworkListenThread.java:54)
                  at net.minecraft.server.integrated.IntegratedServerListenThread.networkTick(IntegratedServerListenThread.java:109)
                  at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:691)
                  at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:587)
                  at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:129)
                  at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:484)
                  at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16)
                  
                  -- System Details --
                  Details:
                  Minecraft Version: 1.6.4
                  Operating System: Linux (i386) version 3.8.0-34-generic
                  Java Version: 1.7.0_45, Oracle Corporation
                  Java VM Version: Java HotSpot(TM) Client VM (mixed mode), Oracle Corporation
                  Memory: 856063448 bytes (816 MB) / 1060372480 bytes (1011 MB) up to 1060372480 bytes (1011 MB)
                  JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
                  AABB Pool Size: 726 (40656 bytes; 0 MB) allocated, 408 (22848 bytes; 0 MB) used
                  Suspicious classes: FML and Forge are installed
                  IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
                  FML: MCP v8.11 FML v6.4.20.916 Minecraft Forge 9.11.1.916 5 mods loaded, 5 mods active
                  mcp{8.09} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
                  FML{6.4.20.916} [Forge Mod Loader] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
                  Forge{9.11.1.916} [Minecraft Forge] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
                  noob{INDEV} [Horizon 2.0] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
                  terracraft{0.3.0} [Terraria on Minecraft] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
                  Profiler Position: N/A (disabled)
                  Vec3 Pool Size: 72 (4032 bytes; 0 MB) allocated, 53 (2968 bytes; 0 MB) used
                  Player Count: 1 / 8; [EntityPlayerMP['Player969'/25, l='Mod terracraft', x=-730,41, y=4,00, z=654,26]]
                  Type: Integrated Server (map_client.txt)
                  Is Modded: Definitely; Client brand changed to 'fml,forge'
                  
                  1 réponse Dernière réponse Répondre Citer 0
                  • GuguG Hors-ligne
                    Gugu
                    dernière édition par

                    Je travaille sur les propriété d’entité actuellement.

                    
                    IExtendedEntityProperties prop = event.entity.getExtendedProperties("Custom Player");
                    
                    

                    Essaie

                    
                    CustomPlayer prop = new CustomPlayer(source.getEntityWorld());
                    
                    

                    "If you have a comprehensive explanation for everything then it decreases uncertainty and anxiety and reduces your cognitive load. And if you can use that simplifying algorithm to put yourself on the side of moral virtue then you’re constantly a good person with a minimum of effort."
                    ― Jordan B. Peterson

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

                      Il me met une erreur à getEntityWorld()


                      désolé j’ai rien dit. En faisant cast sur le getEntityWorld() tout marche correctement ou presque cela affiche bien: “Mana de Player961= 1” mais il le ré-affiche a chaque fois et ne mais pas a jour la valeur de mana.

                      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

                        Non gugu, avec ça tu créer a chaque fois une nouvelle instance, le premier code était bon.
                        Tu as quoi à la ligne 29 de AddCustomPlayerProperties.java ?

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

                          Voila ce que j’ai à la ligne 29 :

                          int mana = ((CustomPlayer)prop).getMana()+1;
                          
                          1 réponse Dernière réponse Répondre Citer 0
                          • GuguG Hors-ligne
                            Gugu
                            dernière édition par

                            Si tu a suivi le tutoriel sur MinecraftForums.net, je l’ai suivi aussi, et il marche a la perfection.

                            "If you have a comprehensive explanation for everything then it decreases uncertainty and anxiety and reduces your cognitive load. And if you can use that simplifying algorithm to put yourself on the side of moral virtue then you’re constantly a good person with a minimum of effort."
                            ― Jordan B. Peterson

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

                              Je n’est pas suivit celui là. Je vais regarder ce tutoriel la.

                              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

                                Renvoie tout tes codes, il y a un npe sur la ligne que tu a envoyé, donc je pense que le custom player prop est null. Il me faut tout tes codes actuels pour savoir pourquoi.

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

                                  Voila le code de AddCustomPlayerProperties:

                                  package noob.common;
                                  
                                  import net.minecraft.entity.Entity;
                                  import net.minecraft.entity.player.EntityPlayer;
                                  import net.minecraftforge.common.IExtendedEntityProperties;
                                  import net.minecraftforge.event.ForgeSubscribe;
                                  import net.minecraftforge.event.entity.EntityEvent.EntityConstructing;
                                  import net.minecraftforge.event.entity.living.LivingDeathEvent;
                                  
                                  public class AddCustomPlayerProperties
                                  {
                                  
                                  @ForgeSubscribe
                                  public void init(EntityConstructing event)
                                  {
                                  if (event.entity instanceof EntityPlayer)
                                  {
                                  event.entity.registerExtendedProperties("Player", new CustomPlayer(event.entity.worldObj));
                                  }
                                  }
                                  
                                  @ForgeSubscribe
                                  public void death(LivingDeathEvent event)
                                  {
                                  Entity source = event.source.getEntity();
                                  if (source != null && source instanceof EntityPlayer)
                                  {
                                  IExtendedEntityProperties prop = event.entity.getExtendedProperties("Custom Player");
                                  int mana = ((CustomPlayer)prop).getMana()+1;
                                  System.out.println("Mana de "+source.getEntityName()+"= "+mana);
                                  ((CustomPlayer)prop).setMana(mana);
                                  }
                                  }
                                  
                                  }
                                  
                                  1 réponse Dernière réponse Répondre Citer 0
                                  • GuguG Hors-ligne
                                    Gugu
                                    dernière édition par

                                    Je te conseille le tutoriel ici :

                                    http://www.minecraftforum.net/topic/1952901-eventhandler-and-iextendedentityproperties/#entry24051513

                                    Car celui que tu utilise est fait de manière bizarre, il utilise l’interface pour appeler ton Custom Player.

                                    "If you have a comprehensive explanation for everything then it decreases uncertainty and anxiety and reduces your cognitive load. And if you can use that simplifying algorithm to put yourself on the side of moral virtue then you’re constantly a good person with a minimum of effort."
                                    ― Jordan B. Peterson

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

                                      Ok merci je vais regarder.


                                      Merci beaucoup sa marche!
                                      Je pense que je vais pouvoir avancé maintenant.

                                      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

                                        Juste pour information, le NPE d’avant été causé car tu n’avais pas le bon nom :

                                        IExtendedEntityProperties prop = event.entity.getExtendedProperties("Custom Player");
                                        

                                        La où tu l’as utilisé et :

                                        event.entity.registerExtendedProperties("Player", new CustomPlayer(event.entity.worldObj));
                                        

                                        La où tu l’as enregistré, si les noms sont pas les mêmes, normal que ça fonctionne pas x).

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

                                        MINECRAFT FORGE FRANCE © 2024

                                        Powered by NodeBB