• S'inscrire
    • Se connecter
    • Recherche
    • Récent
    • Mots-clés
    • Populaire
    • Utilisateurs
    • Groupes

    Résolu Afficher un message dans le chat avec 2 traductions

    1.7.x
    1.7.x
    5
    22
    3650
    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.
    • Axaurus
      Axaurus dernière édition par

      Salut
      Je voudrais afficher un message dans le chat à un jour en particulier. J’ai fait ceci :

      @SubscribeEvent
      public void onEntityJoinWorld(PlayerEvent.PlayerLoggedInEvent worldevent)
      {
      if (calendar.get(2) + 1 == 12 && calendar.get(5) == 25)
      {
      worldevent.player.addChatComponentMessage(new ChatComponentTranslation("msg.christmas.merry1" + " " + worldevent.player.getDisplayName() + " ! " + "msg.christmas.merry2"));
      }
      }
      ``` et ça s'affiche bien dans le chat quand le joueur rejoint le monde.
      
      Le problème, c'est que ça affiche dans le chat :
      msg.christmas.merry1 Player174! msg.christmas.merry2
      
      J'ai cherché et j'ai ajouter ```java
      , new Object[0]
      ``` après merry2". Ca ne marche pas. J'ai essayer de l'ajouter après merry1" et merry2", ça n'affiche que le 1er message traduit.
      
      J'ai essayé d'autres trucs, mais y'a des erreurs dans le code.
      
      Si vous savez comment faire, …
      
      Merci d'avance
      
      PS : J'ai aussi essayer ```java
      worldevent.player.addChatComponentMessage(new ChatComponentTranslation("msg.christmas.merry1", new Object[0]));
      worldevent.player.addChatComponentMessage(new ChatComponentTranslation(" " + worldevent.player.getDisplayName() + " ! "));
      worldevent.player.addChatComponentMessage(new ChatComponentTranslation("msg.christmas.merry2", new Object[0]));
      ```, mais ça met le message sur 3 lignes
      1 réponse Dernière réponse Répondre Citer 0
      • robin4002
        robin4002 Moddeurs confirmés Rédacteurs Administrateurs dernière édition par

        Ça ne fonctionnera pas comme ça. Le tableau sert pour le formatage (ajout de valeur) pas pour mettre deux string.
        Il faut passer par un tchat compound text avec deux texte traduit (avec StatCollector.translate) le problème c’est que ça va prendre la langue du serveur et non du client.

        1 réponse Dernière réponse Répondre Citer 0
        • Axaurus
          Axaurus dernière édition par

          J’ai essayer ce que t’as dit (du moins je crois que c’est ce que tu m’as dit que j’ai mis) et ça ne marchait toujours pas. Mais je me suis souvenu que j’avais utiliser (sans faire gaffe que je l’avais utilisé) un “truc” pour traduire : I18n.format
          Je l’ai trouvé dans un des mes sujet sur le site (Un système de trade : le GUI).
          Et ça marche parfaitement dans n’importe quel langue (du moins en français et anglais).

          Voilà mon code : ```java
          @SubscribeEvent
          public void onEntityJoinWorld(PlayerEvent.PlayerLoggedInEvent worldevent)
          {
          if (calendar.get(2) + 1 == 12 && calendar.get(5) == 25)
          {
               worldevent.player.addChatMessage(new ChatComponentTranslation(I18n.format(“msg.christmas.merry1”) + " " + worldevent.player.getDisplayName() + " ! " + I18n.format(“msg.christmas.merry2”)));
          }
          }

          
          Merci ;)
          
          PS : un petit tips pour ceux qui pourraient potentiellement lire : pour pouvoir formaté votre message, utilisez EnumChatFormatting.
          1 réponse Dernière réponse Répondre Citer 0
          • robin4002
            robin4002 Moddeurs confirmés Rédacteurs Administrateurs dernière édition par

            I18n existe pas côté serveur. Tu vas de manger un crash.
            Et maintenant que je réponds à ton message depuis mon pc je vois mieux ce que tu veux faire (j’étais sur mon smartphone pour l’autre message).
            Tu n’as pas du tout besoin d’utiliser deux strings.
            Tu peux le faire en un seul.
            Suffit de faire :

            worldevent.player.addChatMessage(new ChatComponentTranslation("nom.dans.le.fichier.lang", worldevent.player.getDisplayName());
            

            Et ensuite dans le fichier lang :

            nom.dans.le.fichier.lang=morceau de message avant le pseudo %s ! morceau de message après le pseudo
            

            %s sera remplacé par worldevent.player.getDisplayName()

            1 réponse Dernière réponse Répondre Citer 0
            • Axaurus
              Axaurus dernière édition par

              Effectivement, j’ai testé et ça marche.

              Par contre, j’ai deux problèmes : quand je met EnumChatFormatting.BOLD.DARK_GREEN, ça m’annule la traduction et me raffiche msg.christmas.merry. Sans, ça marche très bien, mais avec le vieux blanc tout moche. Le deuxième problème (certes moins important mais …), c’est que quand je me connecte à un serveur, ça n’affiche rien (avant aussi ça n’affichait rien). Il faut peut être utiliser un autre event qui concerne la connexion au serveur mais je ne pense pas : l’event que j’ai pris dis que c’est quand le joueur se connecte.
              C’est bizarre 😕

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

                L’enum EnumChatFormatting permet juste d’afficher un § avec le nombre hexa de la couleur, il faut juste l’afficher avant le texte

                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
                • robin4002
                  robin4002 Moddeurs confirmés Rédacteurs Administrateurs dernière édition par

                  PlayerEvent.PlayerLoggedInEvent devrait pourtant fonctionner avec les serveurs.
                  Pour les couleurs il suffit de mettre § `dans le fichier lang. Ou alors tu peux utiliser ChatStyle :

                  worldevent.player.addChatMessage(new ChatComponentTranslation("nom.dans.le.fichier.lang", worldevent.player.getDisplayName()).setChatStyle((new ChatStyle().setColor(EnumChatFormatting.DARK_GREEN).setBold(true))));
                  
                  1 réponse Dernière réponse Répondre Citer 0
                  • Axaurus
                    Axaurus dernière édition par

                    Salut
                    Ca marche parfaitement le formatage du texte, j’ai utilisé setChatStyle. Mais je ne sais pas si c’est possible de mettre des accent dans le message : j’ai mis des accent dans le message dans le lang.txt, et en jeu ça met des carrés tout moche aux endroits des accents. Si on ne peux pas, j’aurais juste à enelver les accents du message, mais je préfererai qu’il y en ai.

                    De plus, si quelqu’un saurait comment faire pour que ça affiche le message à la connexion d’un serveur, …
                    Merci d’avance

                    EDIT : je viens d’y penser, je lance le serveur à partir d’Éclipse, ce serait pour ça ? (je ne pense pas mais bon  😐 )

                    1 réponse Dernière réponse Répondre Citer 0
                    • robin4002
                      robin4002 Moddeurs confirmés Rédacteurs Administrateurs dernière édition par

                      Vérifies que tes fichiers lang soient encodé en utf8.
                      Et pour le serveur je ne pense pas 😕

                      Par hasard ta classe en serait pas enregistré que côté client ?

                      1 réponse Dernière réponse Répondre Citer 0
                      • Axaurus
                        Axaurus dernière édition par

                        J’ai changé l’encodage pour l’utf8 et ça marche. Merci 😉
                        Sinon, effectivement il était enregistré par ClientProxy. J’ai mis dans CommonProxy : le serveur crash au lancement et le texte ne s’affiche plus en solo. 😕

                        Voilà ma classe CommonProxy :

                        package This_is_Christmas;
                        
                        import cpw.mods.fml.common.FMLCommonHandler;
                        import net.minecraftforge.common.MinecraftForge;
                        
                        public class CommonProxy {
                        
                        public void registerTextures()
                        {
                        
                        }
                        
                        public void registerRenderThings()
                        {
                        
                        }
                        
                        public void TickEvent()
                        {
                        FMLCommonHandler.instance().bus().register(new EventHandler());
                        MinecraftForge.EVENT_BUS.register(new EventHandler());
                        }
                        }
                        
                        

                        (que je mette FMLCommonHandler ou MinecraftForge, ça bug)
                        Enregistré par ```java

                        proxy.registerRenderThings();
                        proxy.TickEvent();

                        
                        Voilà le crash du server :
                        

                        [17:14:11] [main/INFO] [GradleStart]: Extra: []
                        [17:14:11] [main/INFO] [GradleStart]: Running with arguments: [–tweakClass, cpw.mods.fml.common.launcher.FMLServerTweaker, --tweakClass, net.minecraftforge.gradle.tweakers.CoremodTweaker]
                        [17:14:11] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLServerTweaker
                        [17:14:11] [main/INFO] [LaunchWrapper]: Using primary tweak class name cpw.mods.fml.common.launcher.FMLServerTweaker
                        [17:14:11] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.CoremodTweaker
                        [17:14:11] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLServerTweaker
                        [17:14:12] [main/INFO] [FML]: Forge Mod Loader version 7.99.16.1448 for Minecraft 1.7.10 loading
                        [17:14:12] [main/INFO] [FML]: Java is Java HotSpot™ 64-Bit Server VM, version 1.8.0_60, running on Windows 10:amd64:10.0, installed at C:\Program Files\Java\jre1.8.0_60
                        [17:14:12] [main/INFO] [FML]: Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation
                        [17:14:12] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.CoremodTweaker
                        [17:14:12] [main/INFO] [GradleStart]: Injecting location in coremod cpw.mods.fml.relauncher.FMLCorePlugin
                        [17:14:12] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.classloading.FMLForgePlugin
                        [17:14:12] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker
                        [17:14:12] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLDeobfTweaker
                        [17:14:12] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.AccessTransformerTweaker
                        [17:14:12] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker
                        [17:14:12] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker
                        [17:14:12] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.relauncher.CoreModManager$FMLPluginWrapper
                        [17:14:12] [main/ERROR] [FML]: The binary patch set is missing. Either you are in a development environment, or things are not going to work!
                        [17:14:13] [main/ERROR] [FML]: FML appears to be missing any signature data. This is not a good thing
                        [17:14:13] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.relauncher.CoreModManager$FMLPluginWrapper
                        [17:14:13] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLDeobfTweaker
                        [17:14:14] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.AccessTransformerTweaker
                        [17:14:14] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.TerminalTweaker
                        [17:14:14] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.TerminalTweaker
                        [17:14:14] [main/INFO] [LaunchWrapper]: Launching wrapped minecraft {net.minecraft.server.MinecraftServer}
                        [17:14:16] [main/WARN] [FML]: =============================================================
                        [17:14:16] [main/WARN] [FML]: MOD HAS DIRECT REFERENCE System.exit() THIS IS NOT ALLOWED REROUTING TO FML!
                        [17:14:16] [main/WARN] [FML]: Offendor: net/minecraft/server/gui/MinecraftServerGui$1.windowClosing(Ljava/awt/event/WindowEvent;)V
                        [17:14:16] [main/WARN] [FML]: Use FMLCommonHandler.exitJava instead
                        [17:14:16] [main/WARN] [FML]: =============================================================
                        [17:14:16] [Server thread/INFO]: Starting minecraft server version 1.7.10
                        [17:14:16] [Server thread/INFO] [MinecraftForge]: Attempting early MinecraftForge initialization
                        [17:14:16] [Server thread/INFO] [FML]: MinecraftForge v10.13.4.1448 Initialized
                        [17:14:17] [Server thread/INFO] [FML]: Replaced 183 ore recipies
                        [17:14:17] [Server thread/INFO] [MinecraftForge]: Completed early MinecraftForge initialization
                        [17:14:17] [Server thread/INFO] [FML]: Found 0 mods from the command line. Injecting into mod discoverer
                        [17:14:17] [Server thread/INFO] [FML]: Searching C:\Users\Antonin\OneDrive\Documents\Codage\Minecraft\This_is_Christmas\v1.2\MC1.7\eclipse\mods for mods
                        [17:14:19] [Server thread/INFO] [FML]: Forge Mod Loader has identified 4 mods to load
                        [17:14:20] [Server thread/INFO] [FML]: Attempting connection with missing mods [mcp, FML, Forge, This_is_Christmas] at CLIENT
                        [17:14:20] [Server thread/INFO] [FML]: Attempting connection with missing mods [mcp, FML, Forge, This_is_Christmas] at SERVER
                        [17:14:20] [Server thread/INFO] [FML]: Processing ObjectHolder annotations
                        [17:14:20] [Server thread/INFO] [FML]: Found 341 ObjectHolder annotations
                        [17:14:20] [Server thread/INFO] [FML]: Identifying ItemStackHolder annotations
                        [17:14:20] [Server thread/INFO] [FML]: Found 0 ItemStackHolder annotations
                        [17:14:20] [Server thread/INFO] [FML]: Configured a dormant chunk cache size of 0
                        [17:14:20] [Server thread/INFO] [FML]: Applying holder lookups
                        [17:14:20] [Server thread/INFO] [FML]: Holder lookups applied
                        [17:14:20] [Server thread/INFO] [FML]: Injecting itemstacks
                        [17:14:20] [Server thread/INFO] [FML]: Itemstack injection complete
                        [17:14:20] [Server thread/INFO]: Loading properties
                        [17:14:20] [Server thread/INFO]: Default game type: SURVIVAL
                        [17:14:20] [Server thread/INFO]: Generating keypair
                        [17:14:21] [Server thread/INFO]: Starting Minecraft server on *:25565
                        [17:14:21] [Server thread/WARN]: **** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!
                        [17:14:21] [Server thread/WARN]: The server will make no attempt to authenticate usernames. Beware.
                        [17:14:21] [Server thread/WARN]: While this makes the game possible to play without internet access, it also opens up the ability for hackers to connect with any username they choose.
                        [17:14:21] [Server thread/WARN]: To change this, set “online-mode” to “true” in the server.properties file.
                        [17:14:21] [Server thread/ERROR] [FML]: Fatal errors were detected during the transition from INITIALIZATION to POSTINITIALIZATION. Loading cannot continue
                        [17:14:21] [Server thread/ERROR] [FML]:
                        States: ‘U’ = Unloaded ‘L’ = Loaded ‘C’ = Constructed ‘H’ = Pre-initialized ‘I’ = Initialized ‘J’ = Post-initialized ‘A’ = Available ‘D’ = Disabled ‘E’ = Errored
                        UCHI mcp{9.05} [Minecraft Coder Pack] (minecraft.jar)
                        UCHI FML{7.10.99.99} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.4.1448-1.7.10.jar)
                        UCHI Forge{10.13.4.1448} [Minecraft Forge] (forgeSrc-1.7.10-10.13.4.1448-1.7.10.jar)
                        UCHE This_is_Christmas{1.2} [This is Christmas] (bin)
                        [17:14:21] [Server thread/ERROR] [FML]: The following problems were captured during this phase
                        [17:14:21] [Server thread/ERROR] [FML]: Caught exception from This_is_Christmas
                        java.lang.NoClassDefFoundError: net/minecraft/client/entity/EntityClientPlayerMP
                        at This_is_Christmas.CommonProxy.TickEvent(CommonProxy.java:20) ~[CommonProxy.class:?]
                        at This_is_Christmas.This_is_Christmas.load(This_is_Christmas.java:126) ~[This_is_Christmas.class:?]
                        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_60]
                        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_60]
                        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_60]
                        at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_60]
                        at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:532) ~[FMLModContainer.class:?]
                        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_60]
                        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_60]
                        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_60]
                        at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_60]
                        at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[guava-17.0.jar:?]
                        at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[guava-17.0.jar:?]
                        at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[guava-17.0.jar:?]
                        at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[guava-17.0.jar:?]
                        at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[guava-17.0.jar:?]
                        at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:212) ~[LoadController.class:?]
                        at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:190) ~[LoadController.class:?]
                        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_60]
                        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_60]
                        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_60]
                        at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_60]
                        at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[guava-17.0.jar:?]
                        at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[guava-17.0.jar:?]
                        at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[guava-17.0.jar:?]
                        at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[guava-17.0.jar:?]
                        at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[guava-17.0.jar:?]
                        at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:119) [LoadController.class:?]
                        at cpw.mods.fml.common.Loader.initializeMods(Loader.java:737) [Loader.class:?]
                        at cpw.mods.fml.server.FMLServerHandler.finishServerLoading(FMLServerHandler.java:97) [FMLServerHandler.class:?]
                        at cpw.mods.fml.common.FMLCommonHandler.onServerStarted(FMLCommonHandler.java:319) [FMLCommonHandler.class:?]
                        at net.minecraft.server.dedicated.DedicatedServer.startServer(DedicatedServer.java:213) [DedicatedServer.class:?]
                        at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:445) [MinecraftServer.class:?]
                        at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752) [MinecraftServer$2.class:?]
                        Caused by: java.lang.ClassNotFoundException: net.minecraft.client.entity.EntityClientPlayerMP
                        at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:191) ~[launchwrapper-1.11.jar:?]
                        at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_60]
                        at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_60]
                        … 34 more
                        Caused by: java.lang.RuntimeException: Attempted to load class net/minecraft/client/entity/EntityClientPlayerMP for invalid side SERVER
                        at cpw.mods.fml.common.asm.transformers.SideTransformer.transform(SideTransformer.java:50) ~[forgeSrc-1.7.10-10.13.4.1448-1.7.10.jar:?]
                        at net.minecraft.launchwrapper.LaunchClassLoader.runTransformers(LaunchClassLoader.java:279) ~[launchwrapper-1.11.jar:?]
                        at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:176) ~[launchwrapper-1.11.jar:?]
                        at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_60]
                        at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_60]
                        … 34 more
                        [17:14:21] [Server thread/ERROR]: Encountered an unexpected exception
                        cpw.mods.fml.common.LoaderException: java.lang.NoClassDefFoundError: net/minecraft/client/entity/EntityClientPlayerMP

                        at cpw.mods.fml.common.LoadController.transition(LoadController.java:163) ~[LoadController.class:?]
                        at cpw.mods.fml.common.Loader.initializeMods(Loader.java:739) ~[Loader.class:?]
                        at cpw.mods.fml.server.FMLServerHandler.finishServerLoading(FMLServerHandler.java:97) ~[FMLServerHandler.class:?]
                        at cpw.mods.fml.common.FMLCommonHandler.onServerStarted(FMLCommonHandler.java:319) ~[FMLCommonHandler.class:?]
                        at net.minecraft.server.dedicated.DedicatedServer.startServer(DedicatedServer.java:213) ~[DedicatedServer.class:?]
                        at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:445) [MinecraftServer.class:?]
                        at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752) [MinecraftServer$2.class:?]
                        Caused by: java.lang.NoClassDefFoundError: net/minecraft/client/entity/EntityClientPlayerMP
                        at This_is_Christmas.CommonProxy.TickEvent(CommonProxy.java:20) ~[CommonProxy.class:?]
                        at This_is_Christmas.This_is_Christmas.load(This_is_Christmas.java:126) ~[This_is_Christmas.class:?]
                        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_60]
                        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_60]
                        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_60]
                        at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_60]
                        at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:532) ~[FMLModContainer.class:?]
                        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_60]
                        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_60]
                        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_60]
                        at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_60]
                        at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[guava-17.0.jar:?]
                        at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[guava-17.0.jar:?]
                        at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[guava-17.0.jar:?]
                        at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[guava-17.0.jar:?]
                        at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[guava-17.0.jar:?]
                        at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:212) ~[LoadController.class:?]
                        at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:190) ~[LoadController.class:?]
                        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_60]
                        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_60]
                        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_60]
                        at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_60]
                        at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[guava-17.0.jar:?]
                        at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[guava-17.0.jar:?]
                        at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[guava-17.0.jar:?]
                        at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[guava-17.0.jar:?]
                        at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[guava-17.0.jar:?]
                        at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:119) ~[LoadController.class:?]
                        at cpw.mods.fml.common.Loader.initializeMods(Loader.java:737) ~[Loader.class:?]
                        … 5 more
                        Caused by: java.lang.ClassNotFoundException: net.minecraft.client.entity.EntityClientPlayerMP
                        at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:191) ~[launchwrapper-1.11.jar:?]
                        at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_60]
                        at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_60]
                        at This_is_Christmas.CommonProxy.TickEvent(CommonProxy.java:20) ~[CommonProxy.class:?]
                        at This_is_Christmas.This_is_Christmas.load(This_is_Christmas.java:126) ~[This_is_Christmas.class:?]
                        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_60]
                        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_60]
                        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_60]
                        at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_60]
                        at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:532) ~[FMLModContainer.class:?]
                        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_60]
                        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_60]
                        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_60]
                        at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_60]
                        at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[guava-17.0.jar:?]
                        at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[guava-17.0.jar:?]
                        at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[guava-17.0.jar:?]
                        at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[guava-17.0.jar:?]
                        at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[guava-17.0.jar:?]
                        at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:212) ~[LoadController.class:?]
                        at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:190) ~[LoadController.class:?]
                        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_60]
                        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_60]
                        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_60]
                        at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_60]
                        at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[guava-17.0.jar:?]
                        at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[guava-17.0.jar:?]
                        at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[guava-17.0.jar:?]
                        at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[guava-17.0.jar:?]
                        at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[guava-17.0.jar:?]
                        at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:119) ~[LoadController.class:?]
                        at cpw.mods.fml.common.Loader.initializeMods(Loader.java:737) ~[Loader.class:?]
                        … 5 more
                        Caused by: java.lang.RuntimeException: Attempted to load class net/minecraft/client/entity/EntityClientPlayerMP for invalid side SERVER
                        at cpw.mods.fml.common.asm.transformers.SideTransformer.transform(SideTransformer.java:50) ~[forgeSrc-1.7.10-10.13.4.1448-1.7.10.jar:?]
                        at net.minecraft.launchwrapper.LaunchClassLoader.runTransformers(LaunchClassLoader.java:279) ~[launchwrapper-1.11.jar:?]
                        at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:176) ~[launchwrapper-1.11.jar:?]
                        at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_60]
                        at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_60]
                        at This_is_Christmas.CommonProxy.TickEvent(CommonProxy.java:20) ~[CommonProxy.class:?]
                        at This_is_Christmas.This_is_Christmas.load(This_is_Christmas.java:126) ~[This_is_Christmas.class:?]
                        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_60]
                        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_60]
                        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_60]
                        at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_60]
                        at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:532) ~[FMLModContainer.class:?]
                        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_60]
                        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_60]
                        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_60]
                        at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_60]
                        at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[guava-17.0.jar:?]
                        at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[guava-17.0.jar:?]
                        at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[guava-17.0.jar:?]
                        at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[guava-17.0.jar:?]
                        at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[guava-17.0.jar:?]
                        at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:212) ~[LoadController.class:?]
                        at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:190) ~[LoadController.class:?]
                        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_60]
                        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_60]
                        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_60]
                        at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_60]
                        at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[guava-17.0.jar:?]
                        at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[guava-17.0.jar:?]
                        at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[guava-17.0.jar:?]
                        at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[guava-17.0.jar:?]
                        at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[guava-17.0.jar:?]
                        at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:119) ~[LoadController.class:?]
                        at cpw.mods.fml.common.Loader.initializeMods(Loader.java:737) ~[Loader.class:?]
                        … 5 more
                        [17:14:21] [Server thread/ERROR]: This crash report has been saved to: C:\Users\Antonin\OneDrive\Documents\Codage\Minecraft\This_is_Christmas\v1.2\MC1.7\eclipse.\crash-reports\crash-2015-12-25_17.14.21-server.txt
                        [17:14:21] [Server thread/WARN] [FML]: Can’t revert to frozen GameData state without freezing first.
                        [17:14:21] [Server thread/INFO] [FML]: Applying holder lookups
                        [17:14:21] [Server thread/INFO] [FML]: Holder lookups applied
                        [17:14:21] [Server thread/INFO] [FML]: The state engine was in incorrect state ERRORED and forced into state SERVER_STOPPED. Errors may have been discarded.
                        [17:14:21] [Server thread/INFO] [FML]: The state engine was in incorrect state ERRORED and forced into state AVAILABLE. Errors may have been discarded.
                        Java HotSpot™ 64-Bit Server VM warning: Using incremental CMS is deprecated and will likely be removed in a future release

                        Ca pointe vers l'enregistrement de mon EventHandler et dans ma classe principale à l'enregistrement de la méthode TickEvent
                        Mais y'a un autre truc bizarre dans le crrash : ça dit que ça ne trouve pas la classe EntityClientPlayerMP, mais quand j'enregistre mon EventHandler dans le clientProxy, pas d'erreur.
                        1 réponse Dernière réponse Répondre Citer 0
                        • robin4002
                          robin4002 Moddeurs confirmés Rédacteurs Administrateurs dernière édition par

                          Met-le dans la classe principale. Et pour le crash EntityClientPlayerMP est une classe client seulement, il ne faut pas l’utiliser côté serveur.

                          1 réponse Dernière réponse Répondre Citer 0
                          • Axaurus
                            Axaurus dernière édition par

                            J’ai trouvé pourquoi ça crash : c’est que j’enregistrai mon eventHandler dans le commonProxy, donc au client et serveur en même temps. Mais dans l’eventHandler, j’avais aussi un event qui gère le son, donc que client, pas serveur. C’est pour ça que ça crashait. J’ai donc fait 2 class : une pour les events client uniquement et une pour les events communes client/serveur. Et ça marche bien, ça affiche bien le message à la connexion.

                            Merci beaucoup Robin 😉

                            EDIT : je viens de m’apercevoir d’un léger problème concernant les dates : si je lance le serveur un autre jour que le 25 décembre (par exemple le 24), et que je change la date pour le 25 et je lance le client, quand je me connecte au serveur ça n’affiche pas le message. Par contre, si je lance le serveur le 25 et que je m’y connecte, ça affiche le message. J’ai utilisé ceci pour les dates :

                            if (calendar.get(2) + 1 == 12 && calendar.get(5) == 25)
                            

                            Ca doit utilisé la date de lancement du serveur. Est-ce possible de récupérer la date de lancement du client ?

                            1 réponse Dernière réponse Répondre Citer 0
                            • jglrxavpok
                              jglrxavpok Modérateurs dernière édition par

                              Fais voir comment tu crées ton instance de Calendar

                              Modérateur sur MFF. 
                              Mon Github: http://github.com/jglrxavpok
                              Mon compte Steam si vous voulez jouer à CS:GO ou TF2 avec moi: https://steamcommunity.com/id/jglrxavpok/

                              1 réponse Dernière réponse Répondre Citer 0
                              • Axaurus
                                Axaurus dernière édition par

                                Salut
                                Désolé du temps de la réponse :

                                Calendar calendar = Calendar.getInstance();
                                
                                1 réponse Dernière réponse Répondre Citer 0
                                • robin4002
                                  robin4002 Moddeurs confirmés Rédacteurs Administrateurs dernière édition par

                                  Et tu as placé où ce code ?

                                  1 réponse Dernière réponse Répondre Citer 0
                                  • Axaurus
                                    Axaurus dernière édition par

                                    dans mon CommonEventHandler, au dessus de l’event. Il ne faut pas le mettre ici ?

                                    1 réponse Dernière réponse Répondre Citer 0
                                    • robin4002
                                      robin4002 Moddeurs confirmés Rédacteurs Administrateurs dernière édition par

                                      Envoies la classe entière car j’arrive pas à repérer.

                                      1 réponse Dernière réponse Répondre Citer 0
                                      • Axaurus
                                        Axaurus dernière édition par

                                        package This_is_Christmas;
                                        
                                        import java.util.Calendar;
                                        
                                        import org.apache.logging.log4j.core.helpers.SystemClock;
                                        
                                        import cpw.mods.fml.common.eventhandler.SubscribeEvent;
                                        import cpw.mods.fml.common.gameevent.PlayerEvent;
                                        import net.minecraft.util.ChatComponentTranslation;
                                        import net.minecraft.util.ChatStyle;
                                        import net.minecraft.util.EnumChatFormatting;
                                        
                                        public class CommonEventHandler {
                                        
                                        Calendar calendar = Calendar.getInstance();
                                        
                                        @SubscribeEvent
                                        public void onPlayerLoggedIn(PlayerEvent.PlayerLoggedInEvent worldevent)
                                        {
                                        if (calendar.get(2) + 1 == 12 && calendar.get(5) == 25)
                                        {
                                        worldevent.player.addChatMessage(new ChatComponentTranslation("msg.christmas.merry", worldevent.player.getDisplayName()).setChatStyle((new ChatStyle().setColor(EnumChatFormatting.DARK_GREEN))));
                                        }
                                        }
                                        }
                                        
                                        
                                        1 réponse Dernière réponse Répondre Citer 0
                                        • robin4002
                                          robin4002 Moddeurs confirmés Rédacteurs Administrateurs dernière édition par

                                          Ton calendar est instancié en même temps que la classe (donc lors du chargement du mod).
                                          C’est pour ça que la date reste celle du lancement.

                                          1 réponse Dernière réponse Répondre Citer 0
                                          • Axaurus
                                            Axaurus dernière édition par

                                            Je comprend pas où c’est qu’il faut que je la mette alors 😕

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

                                            MINECRAFT FORGE FRANCE © 2018

                                            Powered by NodeBB