MFF

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

    Afficher un texte à l'écran

    Planifier Épinglé Verrouillé Déplacé Sans suite
    1.7.x
    65 Messages 7 Publieurs 19.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.
    • robin4002R Hors-ligne
      robin4002 Moddeurs confirmés Rédacteurs Administrateurs
      dernière édition par

      Peut être que le caractère paragraphe cause problème ?
      Il faudrait ajouter des System.out pour voir à quel endroit ça passe.

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

        C’est bon j’ai réglé un petit truc qui manqué, et mon texte c’est bien affiché mais le blème c’est qui s’affiche intanst on peut pas le mêttre pendant un temps ?

        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

          Dans la méthode renderMsg tu as
          this.msgPlayingUpFor = 300; suffit de changer la valeur.

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

            ça change rien 😕 aussi j’ai un autre problème quand je passe dans mon claim ça m’affiche Wilderness mais… y’a un petit changement sur la barre de faim et de coeur:

            http://prntscr.com/4o2cd5

            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 ton code actuelle, je crois que je me suis planter quelque part.

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

                Voici le code :

                package fr.frstyle13.ingame;
                
                import java.awt.Color;
                import org.lwjgl.opengl.GL11;
                import net.minecraft.client.Minecraft;
                import net.minecraft.client.gui.FontRenderer;
                import net.minecraft.client.gui.GuiIngame;
                import net.minecraft.client.gui.GuiIngameMenu;
                import net.minecraft.client.gui.GuiMainMenu;
                import net.minecraft.client.gui.GuiScreen;
                import net.minecraft.client.renderer.OpenGlHelper;
                import net.minecraft.init.Blocks;
                import net.minecraftforge.client.GuiIngameForge;
                import net.minecraftforge.client.event.ClientChatReceivedEvent;
                import net.minecraftforge.client.event.RenderGameOverlayEvent;
                import net.minecraftforge.common.MinecraftForge;
                import cpw.mods.fml.common.FMLCommonHandler;
                import cpw.mods.fml.common.Mod;
                import cpw.mods.fml.common.Mod.EventHandler;
                import cpw.mods.fml.common.event.FMLInitializationEvent;
                import cpw.mods.fml.common.eventhandler.SubscribeEvent;
                import cpw.mods.fml.common.gameevent.TickEvent;
                import cpw.mods.fml.common.gameevent.TickEvent.Phase;
                import cpw.mods.fml.relauncher.Side;
                import cpw.mods.fml.relauncher.SideOnly;
                
                @Mod(modid = BaseMod.MODID, version = BaseMod.VERSION)
                public class BaseMod
                {
                   public static final String MODID = "GuiInGame";
                   public static final String VERSION = "1.0";
                
                   protected String msgPlaying = "";
                   protected int msgPlayingUpFor = 0;
                
                   @EventHandler
                   public void init(FMLInitializationEvent event)
                   {
                       FMLCommonHandler.instance().bus().register(this);
                       MinecraftForge.EVENT_BUS.register(this);
                   }
                
                   @SubscribeEvent
                   @SideOnly(Side.CLIENT)
                   public void onGuiIngameRender(RenderGameOverlayEvent.Post event)
                   {
                       if (this.msgPlayingUpFor > 0)
                       {
                           String str = "§e ~" + this.msgPlaying;
                           int x = 1;
                           int y = 6;
                
                           Minecraft.getMinecraft().fontRenderer.drawStringWithShadow(str, x - Minecraft.getMinecraft().fontRenderer.getStringWidth(str) / 2, y, Integer.MAX_VALUE);
                
                       }
                       else
                       {
                            this.msgPlayingUpFor–;
                       }
                   }
                
                   public void renderMsg(String message)
                   {
                     this.msgPlaying = message;
                     this.msgPlayingUpFor = 60;
                   }
                
                   @SubscribeEvent
                   @EventHandler
                   public void onClientChatMessage(ClientChatReceivedEvent event)
                   {
                           if(event.message.getFormattedText().startsWith("§e ~"))
                           {
                            System.out.println("DEBUG");
                               this.renderMsg(event.message.getFormattedText());
                               event.setCanceled(true);
                           }
                           System.out.println("DEBUG : " + event.message.getFormattedText());
                   }
                }
                
                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

                  Fait plutôt comme ça :

                  package fr.frstyle13.ingame;
                  
                  import java.awt.Color;
                  import org.lwjgl.opengl.GL11;
                  import net.minecraft.client.Minecraft;
                  import net.minecraft.client.gui.FontRenderer;
                  import net.minecraft.client.gui.GuiIngame;
                  import net.minecraft.client.gui.GuiIngameMenu;
                  import net.minecraft.client.gui.GuiMainMenu;
                  import net.minecraft.client.gui.GuiScreen;
                  import net.minecraft.client.renderer.OpenGlHelper;
                  import net.minecraft.init.Blocks;
                  import net.minecraftforge.client.GuiIngameForge;
                  import net.minecraftforge.client.event.ClientChatReceivedEvent;
                  import net.minecraftforge.client.event.RenderGameOverlayEvent;
                  import net.minecraftforge.common.MinecraftForge;
                  import cpw.mods.fml.common.FMLCommonHandler;
                  import cpw.mods.fml.common.Mod;
                  import cpw.mods.fml.common.Mod.EventHandler;
                  import cpw.mods.fml.common.event.FMLInitializationEvent;
                  import cpw.mods.fml.common.eventhandler.SubscribeEvent;
                  import cpw.mods.fml.common.gameevent.TickEvent;
                  import cpw.mods.fml.common.gameevent.TickEvent.Phase;
                  import cpw.mods.fml.relauncher.Side;
                  import cpw.mods.fml.relauncher.SideOnly;
                  
                      @Mod(modid = BaseMod.MODID, version = BaseMod.VERSION)
                      public class BaseMod
                      {
                          public static final String MODID = "GuiInGame";
                          public static final String VERSION = "1.0";
                  
                          protected String msgPlaying = "";
                          protected int msgPlayingUpFor = 0;
                  
                          @EventHandler
                          public void init(FMLInitializationEvent event)
                          {
                              FMLCommonHandler.instance().bus().register(this);
                              MinecraftForge.EVENT_BUS.register(this);
                          }
                  
                          @SubscribeEvent
                          @SideOnly(Side.CLIENT)
                          public void onGuiIngameRender(RenderGameOverlayEvent.Post event)
                          {
                              if (this.msgPlayingUpFor > 0)
                              {
                                  this.msgPlayingUpFor–;
                                  String str = "§e ~" + this.msgPlaying;
                                  int x = 1;
                                  int y = 6;
                  
                                  Minecraft.getMinecraft().fontRenderer.drawStringWithShadow(str, x - Minecraft.getMinecraft().fontRenderer.getStringWidth(str) / 2, y, Integer.MAX_VALUE);
                  
                              }
                          }
                  
                          public void renderMsg(String message)
                          {
                            this.msgPlaying = message;
                            this.msgPlayingUpFor = 180;
                          }
                  
                          @SubscribeEvent
                          @EventHandler
                          public void onClientChatMessage(ClientChatReceivedEvent event)
                          {
                                  if(event.message.getFormattedText().startsWith("§e ~"))
                                  {
                                      System.out.println("DEBUG");
                                      this.renderMsg(event.message.getFormattedText());
                                      event.setCanceled(true);
                                  }
                                  System.out.println("DEBUG : " + event.message.getFormattedText());
                          }
                      }
                  

                  Fait comme ça.

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

                    oui sa fonctionne le temps sa fait un temps de 4s mais… sa m’affiche toujours le truc transparent

                    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

                      Remplace

                      RenderGameOverlayEvent.Post par RenderGameOverlayEvent.Text

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

                        Merci  😄

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

                          Merci par contre j’aimerais que mon texte sois bien placé comme le texte du CD ( Now Playing : ‘Nom du CD’ ) car la taille de mon texte dépend de la fenêtre du minecraft ( sois petite sois grande ) et le texte du CD est toujours bien placé au dessus de la barre d’xp selon la taille de la fenêtre

                          1 réponse Dernière réponse Répondre Citer 0
                          • isadorI Hors-ligne
                            isador Moddeurs confirmés Modérateurs
                            dernière édition par

                            %(#000000)[[font=monospace]Minecraft]%(#666600)[[font=monospace].]%(#000000)[[font=monospace]getMinecraft]%(#666600)[[font=monospace]().]%(#000000)[[font=monospace]fontRenderer]%(#666600)[[font=monospace].]%(#000000)[[font=monospace]drawStringWithShadow]%(#666600)[[font=monospace](]%(#000000)[[font=monospace]str]%(#666600)[[font=monospace],]%(#000000)[[font=monospace] x ]%(#666600)[[font=monospace]-] %(#000000)[[font=monospace]Minecraft]%(#666600)[[font=monospace].]%(#000000)[[font=monospace]getMinecraft]%(#666600)[[font=monospace]().]%(#000000)[[font=monospace]fontRenderer]%(#666600)[[font=monospace].]%(#000000)[[font=monospace]getStringWidth]%(#666600)[[font=monospace](]%(#000000)[[font=monospace]str]%(#666600)[[font=monospace])] %(#666600)[[font=monospace]/] %(#646464)[[font=monospace]2]%(#666600)[[font=monospace],]%(#000000)[[font=monospace] y]%(#666600)[[font=monospace],] %(#000000)[[font=monospace]Integer]%(#666600)[[font=monospace].]%(#000000)[[font=monospace]MAX_VALUE]%(#666600)[[font=monospace]);]
                            

                            [size=smallModifie cette ligne]

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

                              Je sais -_- mais quand j’essaye avec le code du CD sa fonctionne pas

                              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

                                Suffit de changer la valeur x et la valeur y …
                                Tu peux utiliser event.resolution.getScaledWidth() / 2 et event.resolution.getScaledHeight() / 2 pour avoir le centre de l’écran.

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

                                  Alors enfaite le problème c’est que si je créer pas le package net.minecraftforge.client avec GuiIngameForge ( Sans modifier quelque chose dans la class de GuiIngameForge) ça ne fonctionne pas , si je  le créer pas ça m’affiche mon texte dans le chat au lieu au millieu de l’écran

                                  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

                                    Heu ça c’est pas normal, tu as changé quoi dans cette classe ?

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

                                      Rien du tout justement, j’ai juste recopier le vrai GuiIngameForge sans rien changer

                                      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

                                        Pas normal … Tu peux m’envoie un zip de ton dossier src ?

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

                                          http://originspvp.fr/src.zip

                                          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

                                            ​ @SubscribeEvent
                                            @SideOnly(Side.CLIENT)
                                            public void onGuiIngameRender(RenderGameOverlayEvent.Text event)
                                            {
                                            if(this.msgPlayingUpFor > 0)
                                            {
                                            this.msgPlayingUpFor–;
                                            String str = "§f Faction:" + this.msgPlaying;
                                            Minecraft.getMinecraft().fontRenderer.drawString(str, (event.resolution.getScaledWidth() / 2) - (Minecraft.getMinecraft().fontRenderer.getStringWidth(str) / 2), event.resolution.getScaledHeight() - 68, Integer.MAX_VALUE);
                                            }
                                            }
                                            
                                            1 réponse Dernière réponse Répondre Citer 1
                                            • 1
                                            • 2
                                            • 3
                                            • 4
                                            • 2 / 4
                                            • Premier message
                                              Dernier message
                                            Design by Woryk
                                            ContactMentions Légales

                                            MINECRAFT FORGE FRANCE © 2024

                                            Powered by NodeBB