MFF

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

    Modifier le menu principal

    Planifier Épinglé Verrouillé Déplacé Les interfaces (GUI) et les container
    1.11.x
    125 Messages 24 Publieurs 116.2k Vues 19 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.
    • surfeur5S Hors-ligne
      surfeur5 @robin4002
      dernière édition par

      @robin4002 merci sa fonction mes j’ai déformer un crache lord de l’appuy sur un bouton et l’image discord qui s’affiche pas

      code

      package fr.surfruncraft.surfmenu.client;
      
      import fr.surfruncraft.surfmenu.SurfMenu;
      import net.minecraft.client.Minecraft;
      import net.minecraft.client.gui.Gui;
      import net.minecraft.client.gui.GuiButton;
      import net.minecraft.client.renderer.GlStateManager;
      import net.minecraft.util.ResourceLocation;
      
      public class GuiCustomButton extends GuiButton
      {
          private static final ResourceLocation DISCORD_ICON = new ResourceLocation(SurfMenu.MODID, "textures/gui/discord.png");
          private static final ResourceLocation DISCORD_HOVER_ICON = new ResourceLocation(SurfMenu.MODID, "textures/gui/discord_hover.png");
      
          public GuiCustomButton(int buttonId, int x, int y)
          {
              super(buttonId, x, y, 20, 20, ""); // taille de 20x20, pas de nom
          }
      
          public void drawButton(Minecraft mc, int mouseX, int mouseY)
          {
              if(this.visible)
              {
                  boolean mouseHover = mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width && mouseY < this.y + this.height;
                  if(mouseHover) // si la souris est sur le bouton
                  {
                      mc.getTextureManager().bindTexture(DISCORD_HOVER_ICON);
                  }
                  else
                  {
                      mc.getTextureManager().bindTexture(DISCORD_ICON);
                  }
                  GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
                  Gui.drawScaledCustomSizeModalRect(this.x, this.y, 0, 0, 128, 128, 20, 20, 128, 128);
              }
          }
      }
      
      

      et

      package fr.surfruncraft.surfmenu.client;
      
      import com.google.common.collect.Lists;
      import com.google.common.io.CharStreams;
      import com.google.common.util.concurrent.ThreadFactoryBuilder;
      import fr.surfruncraft.surfmenu.SurfMenu;
      import ibxm.Player;
      import net.minecraft.client.Minecraft;
      import net.minecraft.client.gui.*;
      import net.minecraft.client.multiplayer.ServerData;
      import net.minecraft.client.network.ServerPinger;
      import net.minecraft.client.renderer.GlStateManager;
      import net.minecraft.client.renderer.texture.DynamicTexture;
      import net.minecraft.client.resources.I18n;
      import net.minecraft.client.resources.IResource;
      import net.minecraft.util.ResourceLocation;
      import net.minecraft.util.StringUtils;
      import net.minecraft.util.math.MathHelper;
      import net.minecraft.util.text.TextFormatting;
      import net.minecraft.world.storage.ISaveFormat;
      import net.minecraft.world.storage.WorldInfo;
      import net.minecraftforge.fml.client.FMLClientHandler;
      import org.apache.commons.io.Charsets;
      import org.apache.commons.io.IOUtils;
      import org.apache.logging.log4j.LogManager;
      import org.apache.logging.log4j.Logger;
      
      import java.awt.*;
      import java.io.*;
      import java.net.URI;
      import java.net.URISyntaxException;
      import java.net.URL;
      import java.net.UnknownHostException;
      import java.util.Calendar;
      import java.util.Date;
      import java.util.List;
      import java.util.Random;
      import java.util.concurrent.ScheduledThreadPoolExecutor;
      import java.util.concurrent.ThreadPoolExecutor;
      
      public class GuiCustomMainMenu extends GuiScreen
      {
          private static final Logger LOGGER = LogManager.getLogger();
          private static final Random RANDOM = new Random();
      
          /** The splash message. */
          private String splashText;
          private GuiButton buttonResetDemo;
          /** Timer used to rotate the panorama, increases every tick. */
          private int panoramaTimer;
          /** Texture allocated for the current viewport of the main menu's panorama background. */
          private DynamicTexture viewportTexture;
          /** The Object object utilized as a thread lock when performing non thread-safe operations */
          private final Object threadLock = new Object();
          public static final String MORE_INFO_TEXT = "Please click " + TextFormatting.UNDERLINE + "here" + TextFormatting.RESET + " for more information.";
          /** Width of openGLWarning2 */
          private int openGLWarning2Width;
          /** Width of openGLWarning1 */
          private int openGLWarning1Width;
          /** Left x coordinate of the OpenGL warning */
          private int openGLWarningX1;
          /** Top y coordinate of the OpenGL warning */
          private int openGLWarningY1;
          /** Right x coordinate of the OpenGL warning */
          private int openGLWarningX2;
          /** Bottom y coordinate of the OpenGL warning */
          private int openGLWarningY2;
          /** OpenGL graphics card warning. */
          private String openGLWarning1;
          /** OpenGL graphics card warning. */
          private String openGLWarning2;
          /** Link to the Mojang Support about minimum requirements */
          private String openGLWarningLink;
          //private static final ResourceLocation SPLASH_TEXTS = new ResourceLocation("texts/splashes.txt");
          // titre personnalisé :
          private static final ResourceLocation MFF_TITLE = new ResourceLocation(SurfMenu.MODID, "textures/gui/annonce.png");
          // arrière plan personnalisé :
          private static final ResourceLocation BACKGROUND_TEXTURE = new ResourceLocation(SurfMenu.MODID, "textures/gui/background.png");
      
          private ResourceLocation backgroundTexture;
          private GuiButton modButton;
      
          // début information serveur
          private final ServerPinger serverPinger = new ServerPinger();
          private ServerData server = new ServerData("localserver", "play.surfruncraft.fr:25565", false);
          private static final ThreadPoolExecutor EXECUTOR = new ScheduledThreadPoolExecutor(5, (new ThreadFactoryBuilder()).setNameFormat("Server Pinger #%d").setDaemon(true).build());
          // fin information serveur
      
          // début texte defilant
          private int scrollingTextPosX;
          private String scrollingText;
          // fin texte defilant
      
          public GuiCustomMainMenu()
          {
              // début texte defilant
              new Thread()
              {
                  @Override
                  public void run()
                  {
                      try
                      {
                          URL url = new URL("http://dl.mcnanotech.fr/mff/tutoriels/mainmenutext.txt");
                          InputStream is = url.openStream();
                          GuiCustomMainMenu.this.scrollingText = CharStreams.toString(new InputStreamReader(is, Charsets.UTF_8));
                      }
                      catch(Exception e)
                      {
                          GuiCustomMainMenu.this.scrollingText = "Impossible de lire le texte";
                      }
                  }
              }.start();
              // fin texte defilant
      
      
      
              FMLClientHandler.instance().setupServerList();
      
              /*this.openGLWarning2 = MORE_INFO_TEXT;
              this.splashText = "missingno";
              IResource iresource = null;
              */
      
              /*try
              {
                  List<String> list = Lists.<String>newArrayList();
                  iresource = Minecraft.getMinecraft().getResourceManager().getResource(SPLASH_TEXTS);
                  BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(iresource.getInputStream(), Charsets.UTF_8));
                  String s;
      
                  while ((s = bufferedreader.readLine()) != null)
                  {
                      s = s.trim();
      
                      if (!s.isEmpty())
                      {
                          list.add(s);
                      }
                  }
      
                  if (!list.isEmpty())
                  {
                      while (true)
                      {
                          this.splashText = (String)list.get(RANDOM.nextInt(list.size()));
      
                          if (this.splashText.hashCode() != 125780783)
                          {
                              break;
                          }
                      }
                  }
              }
              catch (IOException var8)
              {
                  ;
              }
              finally
              {
                  IOUtils.closeQuietly((Closeable)iresource);
              }*/
          }
      
          /**
           * Called from the main game loop to update the screen.
           */
          public void updateScreen()
          {
              ++this.panoramaTimer;
          }
      
          /**
           * Returns true if this GUI should pause the game when it is displayed in single-player
           */
          public boolean doesGuiPauseGame()
          {
              return false;
          }
      
          /**
           * Fired when a key is typed (except F11 which toggles full screen). This is the equivalent of
           * KeyListener.keyTyped(KeyEvent e). Args : character (character on the key), keyCode (lwjgl Keyboard key code)
           */
          protected void keyTyped(char typedChar, int keyCode) throws IOException
          {
          }
      
          /**
           * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the
           * window resizes, the buttonList is cleared beforehand.
           */
          public void initGui()
          {
              this.viewportTexture = new DynamicTexture(256, 256);
              this.backgroundTexture = this.mc.getTextureManager().getDynamicTextureLocation("background", this.viewportTexture);
              /**
              Calendar calendar = Calendar.getInstance();
              calendar.setTime(new Date());
      
              if (calendar.get(2) + 1 == 12 && calendar.get(5) == 24)
              {
                  this.splashText = "Merry X-mas!";
              }
              else if (calendar.get(2) + 1 == 1 && calendar.get(5) == 1)
              {
                  this.splashText = "Happy new year!";
              }
              else if (calendar.get(2) + 1 == 10 && calendar.get(5) == 31)
              {
                  this.splashText = "OOoooOOOoooo! Spooky!";
              }
               */
      
              int j = this.height / 4 + 48;
      
      
              if (this.mc.isDemo())
              {
                  this.addDemoButtons(j, 24);
              }
              else
              {
                  this.addSingleplayerMultiplayerButtons(j, 24);
              }
      
              this.buttonList.add(new GuiButton(0, this.width / 2 - 100, j + 72 + 12, 98, 20, I18n.format("menu.options")));
              this.buttonList.add(new GuiButton(4, this.width / 2 + 2, j + 72 + 12, 98, 20, I18n.format("menu.quit")));
              this.buttonList.add(new GuiButtonLanguage(5, this.width / 2 - 124, j + 72 + 12));
              this.buttonList.add(new GuiCustomButton(21, this.width / 2 - 124, j + 24));
      
              synchronized (this.threadLock)
              {
                  this.openGLWarning1Width = this.fontRenderer.getStringWidth(this.openGLWarning1);
                  this.openGLWarning2Width = this.fontRenderer.getStringWidth(this.openGLWarning2);
                  int k = Math.max(this.openGLWarning1Width, this.openGLWarning2Width);
                  this.openGLWarningX1 = (this.width - k) / 2;
                  this.openGLWarningY1 = ((GuiButton)this.buttonList.get(0)).y - 24;
                  this.openGLWarningX2 = this.openGLWarningX1 + k;
                  this.openGLWarningY2 = this.openGLWarningY1 + 24;
              }
      
              this.mc.setConnectedToRealms(false);
          }
      
          /**
           * Adds Singleplayer and Multiplayer buttons on Main Menu for players who have bought the game.
           */
          private void addSingleplayerMultiplayerButtons(int yPos, int yInterval)
          {
              this.buttonList.add(new GuiButton(1, this.width / 2 - 100, yPos, I18n.format("menu.singleplayer")));
              //this.buttonList.add(new GuiButton(2, this.width / 2 - 100, yPos + yInterval * 1, I18n.format("menu.multiplayer", new Object[0])));
              this.buttonList.add(new GuiButton(20, this.width / 2 - 100, yPos + yInterval * 1, I18n.format("menu.localserver")));
              this.buttonList.add(modButton = new GuiButton(6, this.width / 2 - 100, yPos + yInterval * 2, I18n.format("fml.menu.mods")));
          }
      
          /**
           * Adds Demo buttons on Main Menu for players who are playing Demo.
           */
          private void addDemoButtons(int p_73972_1_, int p_73972_2_)
          {
              this.buttonList.add(new GuiButton(11, this.width / 2 - 100, p_73972_1_, I18n.format("menu.playdemo")));
              this.buttonResetDemo = this.addButton(new GuiButton(12, this.width / 2 - 100, p_73972_1_ + p_73972_2_ * 1, I18n.format("menu.resetdemo")));
              ISaveFormat isaveformat = this.mc.getSaveLoader();
              WorldInfo worldinfo = isaveformat.getWorldInfo("Demo_World");
      
              if (worldinfo == null)
              {
                  this.buttonResetDemo.enabled = false;
              }
          }
      
          /**
           * Called by the controls from the buttonList when activated. (Mouse pressed for buttons)
           */
          protected void actionPerformed(GuiButton button) throws IOException
          {
              if (button.id == 0)
              {
                  this.mc.displayGuiScreen(new GuiOptions(this, this.mc.gameSettings));
              }
      
              if (button.id == 5)
              {
                  this.mc.displayGuiScreen(new GuiLanguage(this, this.mc.gameSettings, this.mc.getLanguageManager()));
              }
      
              if (button.id == 1)
              {
                  this.mc.displayGuiScreen(new GuiWorldSelection(this));
              }
      
              if (button.id == 2)
              {
                  this.mc.displayGuiScreen(new GuiMultiplayer(this));
              }
      
              if (button.id == 4)
              {
                  this.mc.shutdown();
              }
      
              if (button.id == 6)
              {
                  this.mc.displayGuiScreen(new net.minecraftforge.fml.client.GuiModList(this));
              }
      
              /*if (button.id == 11)
              {
                  this.mc.launchIntegratedServer("Demo_World", "Demo_World", WorldServer.);
              }*/
      
              if (button.id == 12)
              {
                  ISaveFormat isaveformat = this.mc.getSaveLoader();
                  WorldInfo worldinfo = isaveformat.getWorldInfo("Demo_World");
      
                  if (worldinfo != null)
                  {
                      this.mc.displayGuiScreen(new GuiYesNo(this, I18n.format("selectWorld.deleteQuestion"), "\'" + worldinfo.getWorldName() + "\' " + I18n.format("selectWorld.deleteWarning"), I18n.format("selectWorld.deleteButton"), I18n.format("gui.cancel"), 12));
                  }
              }
      
              if(button.id == 20)
              {
                  FMLClientHandler.instance().connectToServer(this, new ServerData("localserver", "149.202.108.218:25565", false));
      
              }
      
              if(button.id == 21)
              {
                  try
                  {
                      Desktop.getDesktop().browse(new URI("http://discord.surfruncraft.fr"));
                  }
                  catch(URISyntaxException e)
                  {
                      e.printStackTrace();
                  }
              }
          }
      
          public void confirmClicked(boolean result, int id)
          {
              if (result && id == 12)
              {
                  ISaveFormat isaveformat = this.mc.getSaveLoader();
                  isaveformat.flushCache();
                  isaveformat.deleteWorldDirectory("Demo_World");
                  this.mc.displayGuiScreen(this);
              }
              else if (id == 12)
              {
                  this.mc.displayGuiScreen(this);
              }
              else if (id == 13)
              {
                  if (result)
                  {
                      try
                      {
                          Class<?> oclass = Class.forName("java.awt.Desktop");
                          Object object = oclass.getMethod("getDesktop", new Class[0]).invoke((Object)null, new Object[0]);
                          oclass.getMethod("browse", new Class[] {URI.class}).invoke(object, new Object[] {new URI(this.openGLWarningLink)});
                      }
                      catch (Throwable throwable)
                      {
                          LOGGER.error("Couldn\'t open link", throwable);
                      }
                  }
      
                  this.mc.displayGuiScreen(this);
              }
          }
      
          /**
           * Draws the screen and all the components in it.
           */
          public void drawScreen(int mouseX, int mouseY, float partialTicks)
          {
              // début de l'affichage de l'arrière plan
              mc.getTextureManager().bindTexture(BACKGROUND_TEXTURE);
              GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
              Gui.drawScaledCustomSizeModalRect(0, 0, 0, 0, 1, 1, this.width, this.height, 1, 1);
              GlStateManager.enableAlpha();
              // fin de l'affichage de l'arrière plan
      
              // début de l'affichage du titre
              this.mc.getTextureManager().bindTexture(MFF_TITLE);
              GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
              GlStateManager.enableBlend(); // pour la semi-transparence
              GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); // pour la semi-transparence
              Gui.drawScaledCustomSizeModalRect(this.width / 2 - 150, 25, 0, 0, 1, 1, 300, 60, 1, 1);
              GlStateManager.disableBlend(); // pour la semi-transparence
              // fin de l'affichage du titre
      
              // début info serveur
              if(!this.server.pinged)
              {
                  this.server.pinged = true;
                  this.server.pingToServer = -2L;
                  this.server.serverMOTD = "";
                  this.server.populationInfo = "";
                  EXECUTOR.submit(new Runnable()
                  {
                      @Override
                      public void run()
                      {
                          try
                          {
                              GuiCustomMainMenu.this.serverPinger.ping(GuiCustomMainMenu.this.server);
                          }
                          catch(UnknownHostException unknowHostException)
                          {
                              GuiCustomMainMenu.this.server.pingToServer = -1L;
                              GuiCustomMainMenu.this.server.serverMOTD = TextFormatting.DARK_RED + "Impossible de résoudre le nom d'hôte";
                              // on peut aussi utiliser I18n pour passer par les fichiers de langage
                          }
                          catch(Exception exception)
                          {
                              GuiCustomMainMenu.this.server.pingToServer = -1L;
                              GuiCustomMainMenu.this.server.serverMOTD = TextFormatting.DARK_RED + "Impossible de se connecter au serveur";
                          }
                      }
                  });
              }
              if(this.server.pingToServer >= 0L)
              {
                  this.drawString(this.fontRenderer, this.server.populationInfo + TextFormatting.RESET + " joueurs", this.width / 2 + 110, this.height / 4 + 72, 0x245791);
                  this.drawString(this.fontRenderer, this.server.pingToServer + " ms", this.width / 2 + 110, this.height / 4 + 82, 0x245791);
                  if(this.server.playerList != null && !this.server.playerList.isEmpty())
                  {
                      List<String> list = this.mc.fontRenderer.listFormattedStringToWidth(this.server.playerList, this.width - (this.width / 2 + 110));
                      for(int i = 0;i < list.size(); i++)
                      {
                          if(i >= 10)
                          {
                              break;
                          }
                          this.drawString(this.fontRenderer, list.get(i), this.width / 2 + 110, this.height / 4 + 92 + 10 * i, 0x245791);
                      }
                  }
                  this.drawCenteredString(this.fontRenderer, this.server.serverMOTD, this.width / 2, this.height / 4 + 24, 0x245791);
              }
              else
              {
                  this.drawString(this.fontRenderer, this.server.serverMOTD, this.width / 2 + 110, this.height / 4 + 72, 0x245791);
              }
              // fin info serveur
      
              // début texte défilant
              this.scrollingTextPosX --;
              if(this.scrollingTextPosX < -this.fontRenderer.getStringWidth(this.scrollingText))
              {
                  this.scrollingTextPosX = this.width;
              }
              this.drawRect(0, 0, this.width, 12, 0x77FFFFFF);
              this.fontRenderer.drawString(this.scrollingText, this.scrollingTextPosX, 2, 0x245791);
              // fin texte défilant
      
              GlStateManager.pushMatrix();
              GlStateManager.translate((float)(this.width / 2 + 90), 70.0F, 0.0F);
              GlStateManager.rotate(-20.0F, 0.0F, 0.0F, 1.0F);
              float f = 1.8F - MathHelper.abs(MathHelper.sin((float)(Minecraft.getSystemTime() % 1000L) / 1000.0F * ((float)Math.PI * 2F)) * 0.1F);
              f = f * 100.0F / (float)(this.fontRenderer.getStringWidth(this.splashText) + 32);
              GlStateManager.scale(f, f, f);
              this.drawCenteredString(this.fontRenderer, this.splashText, 0, 0, -256); // affichage du slash texte. Il peut être intéressant d'adapter la position
              GlStateManager.popMatrix();
              String s = "Surfruncraft";
      
              if (this.mc.isDemo())
              {
                  s = s + " Demo";
              }
              else
              {
                  s = s + ("release".equalsIgnoreCase(this.mc.getVersionType()) ? "" : "/" + this.mc.getVersionType());
              }
      
              java.util.List<String> brandings = com.google.common.collect.Lists.reverse(net.minecraftforge.fml.common.FMLCommonHandler.instance().getBrandings(true));
              for (int brdline = 0; brdline < brandings.size(); brdline++)
              {
                  String brd = brandings.get(brdline);
                  if (!com.google.common.base.Strings.isNullOrEmpty(brd))
                  {
                      this.drawString(this.fontRenderer, brd, 2, this.height - ( 10 + brdline * (this.fontRenderer.FONT_HEIGHT + 1)), 16777215);
                  }
              }
              String s1 = "Copyright Mojang AB. Do not distribute!";
              this.drawString(this.fontRenderer, "Copyright Mojang AB. Do not distribute!", this.width - this.fontRenderer.getStringWidth("Copyright Mojang AB. Do not distribute!") - 2, this.height - 10, -1);
      
              if (this.openGLWarning1 != null && !this.openGLWarning1.isEmpty())
              {
                  drawRect(this.openGLWarningX1 - 2, this.openGLWarningY1 - 2, this.openGLWarningX2 + 2, this.openGLWarningY2 - 1, 1428160512);
                  this.drawString(this.fontRenderer, this.openGLWarning1, this.openGLWarningX1, this.openGLWarningY1, -1);
                  this.drawString(this.fontRenderer, this.openGLWarning2, (this.width - this.openGLWarning2Width) / 2, ((GuiButton)this.buttonList.get(0)).y - 12, -1);
              }
      
              super.drawScreen(mouseX, mouseY, partialTicks);
          }
      
          /**
           * Called when the mouse is clicked. Args : mouseX, mouseY, clickedButton
           */
          protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException
          {
              super.mouseClicked(mouseX, mouseY, mouseButton);
      
              synchronized (this.threadLock)
              {
                  if (!this.openGLWarning1.isEmpty() && !StringUtils.isNullOrEmpty(this.openGLWarningLink) && mouseX >= this.openGLWarningX1 && mouseX <= this.openGLWarningX2 && mouseY >= this.openGLWarningY1 && mouseY <= this.openGLWarningY2)
                  {
                      GuiConfirmOpenLink guiconfirmopenlink = new GuiConfirmOpenLink(this, this.openGLWarningLink, 13, true);
                      guiconfirmopenlink.disableSecurityWarning();
                      this.mc.displayGuiScreen(guiconfirmopenlink);
                  }
              }
          }
      
          /**
           * Called when the screen is unloaded. Used to disable keyboard repeat events
           */
          public void onGuiClosed()
          {
      
          }
      }
      

      crash-2020-11-28_15.07.40-client.txt

      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

        Je n’ai pas l’impression que tu as envoyé le bon rapport de crash.

        surfeur5S 1 réponse Dernière réponse Répondre Citer 0
        • surfeur5S Hors-ligne
          surfeur5 @robin4002
          dernière édition par

          @robin4002

          Ah oui dsl

          crash-2020-11-30_10.30.40-client.txt

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

            Il y a un NPE à la ligne 511, parce que tu as supprimé le code qui initialisation les warning opengl mais tu n’as pas supprimé le code qui l’utilise.

            Enlève les lignes 511 à 516.

            surfeur5S 1 réponse Dernière réponse Répondre Citer 0
            • surfeur5S Hors-ligne
              surfeur5 @robin4002
              dernière édition par

              @robin4002 je vous remercie vraiment de m’aidée et pour l’image ? du discord a3dafced-3b67-4c3e-8e18-d0fcf548122d-image.png

              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 classe du bouton, si tu ajoutes un @Override au dessus de

                public void drawButton(Minecraft mc, int mouseX, int mouseY)
                

                est-ce que tu as une erreur ? Si oui, la signature ou le nom de la fonction a changé, il faut regarder dans GuiButton quel est son nouveau nom.

                surfeur5S 1 réponse Dernière réponse Répondre Citer 0
                • surfeur5S Hors-ligne
                  surfeur5 @robin4002
                  dernière édition par

                  @robin4002 effectivement c’est en rouge

                  f3fd43e2-981c-43d1-a290-a22ce74358dc-image.png

                  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

                    Et donc, tu es allé voir dans GuiButton quel est le bon nom de la fonction pour la 1.12.2 ?

                    surfeur5S 2 réponses Dernière réponse Répondre Citer 0
                    • surfeur5S Hors-ligne
                      surfeur5 @robin4002
                      dernière édition par surfeur5

                      Ce message a été supprimé !
                      1 réponse Dernière réponse Répondre Citer 0
                      • surfeur5S Hors-ligne
                        surfeur5 @robin4002
                        dernière édition par

                        @robin4002 oui et j’ai trouvez merci 😉

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

                          Bonjour on ce trouve le code pour supprimée ceci

                          merci par avance

                          772203a8-548a-42b9-9f7c-6a3eb8418989-image.png

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

                            Supprimer les informations de forge et la version de Minecraft n’est pas une bonne pratique, tu n’aura aucune aide pour enlevé ces informations sur ce forum.

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

                              Bonjour, j’utilise actuellement ce tuto juste pour modifier une petite chose : Quand on quitte un serveur, ça nous amène à la liste des serveurs. Je veux faire en sorte que ça nous amène directement au menu principal (qui celui-ci n’a pas été modifier).
                              Je suis un peu nouveau au développement et je suis aller dans un discord de développement mais malheureusement, je n’est rien trouver. Je suis sur Eclipse en 1.12.2. Merci de m’aider 😉

                              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 robin4002

                                Bonjour,
                                Tu peux utiliser l’event GuiOpenEvent (comme dans ce tutoriel) pour détecter l’ouverture du gui multi-player et ouvrir à la place le menu principal. Cependant avec cette approche il ne sera plus possible d’aller dans le gui de sélection des serveurs.

                                OrgeAlexj06O 1 réponse Dernière réponse Répondre Citer 0
                                • OrgeAlexj06O Hors-ligne
                                  OrgeAlexj06 @robin4002
                                  dernière édition par OrgeAlexj06

                                  @robin4002 Je suis en train de développer un launcher, c’est pour cela que je veux “supprimer” la liste des serveurs. Est-ce bien ca que je dois mettre dans la class MonModClient ?

                                   @SubscribeEvent
                                      public void onOpenGui(GuiOpenEvent event)
                                      {
                                          if(event.getGui() != null && event.getGui().getClass() == GuiMultiplayer.class)
                                          {
                                              event.setGui(new GuiMainMenu());
                                          }
                                      }
                                  

                                  Je précise, je suis en 1.12.2 . Je suis nouveau dans le développement et ton aide me sera très utile. Merci
                                  Bonne soirée à toi

                                  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

                                    Oui c’est bon ainsi.

                                    OrgeAlexj06O 1 réponse Dernière réponse Répondre Citer 0
                                    • OrgeAlexj06O Hors-ligne
                                      OrgeAlexj06 @robin4002
                                      dernière édition par

                                      @robin4002 Salut, j’étais venu quelques mois plus tôt pour demander de l’aide pour mon serveur et j’avais abandonné ce développement et je reviens aujourd’hui pour de l’aide, j’ai coder la procédure (event) dans ma classe principale mais ca ne marche pas…
                                      Voici la classe principal :

                                      package fr.orgealexj06.fgutilities;
                                      
                                      import org.apache.logging.log4j.Logger;
                                      
                                      import net.minecraft.client.gui.GuiMainMenu;
                                      import net.minecraft.client.gui.GuiMultiplayer;
                                      import net.minecraftforge.client.event.GuiOpenEvent;
                                      import net.minecraftforge.fml.common.Mod;
                                      import net.minecraftforge.fml.common.Mod.EventHandler;
                                      import net.minecraftforge.fml.common.Mod.Instance;
                                      import net.minecraftforge.fml.common.SidedProxy;
                                      import net.minecraftforge.fml.common.event.FMLInitializationEvent;
                                      import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
                                      import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
                                      
                                      @Mod(modid = FallenGloryUtilitiesMod.MODID, name = "FallenGlory Utilities", version = "1.0", acceptedMinecraftVersions = "[1.12.2]")
                                      public class FallenGloryUtilitiesMod {
                                      	
                                      	public static final String MODID = "fgutilities";
                                      	
                                      	@Instance(FallenGloryUtilitiesMod.MODID)
                                      	public static FallenGloryUtilitiesMod instance;
                                      	
                                      	@SidedProxy(clientSide = "fr.orgealexj06.fgutilities.FallenGloryUtilitiesClient", serverSide = "fr.orgealexj06.fgutilities.FallenGloryUtilitiesServer")
                                      	public static FallenGloryUtilitiesCommon proxy;
                                      	
                                      	public static Logger logger;
                                      	
                                      	@EventHandler
                                      	public void preInit(FMLPreInitializationEvent event) {
                                      		logger = event.getModLog();
                                      		proxy.preInit(event.getSuggestedConfigurationFile());
                                      	}
                                      	
                                      	@EventHandler
                                      	public void init(FMLInitializationEvent event) {
                                      		proxy.init();
                                      	}
                                      	
                                      	@SubscribeEvent
                                          public void onOpenGui(GuiOpenEvent event)
                                          {
                                              if(event.getGui() != null && event.getGui().getClass() == GuiMultiplayer.class)
                                              {
                                                  event.setGui(new GuiMainMenu());
                                              }
                                          }
                                      }
                                      

                                      Merci de m’apporter un peu d’aide 😉
                                      Si tu as besoin d’autres infos, tu me dit
                                      (J’explique également le but de mon développement dans un message juste au dessus)
                                      Bonne journée

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

                                        Il faut que la classe dans laquelle se trouve ton event soit enregistré comme classe ayant des événements.
                                        https://www.minecraftforgefrance.fr/topic/3948/les-événements#enregistrer-la-classe-contenant-les-événements

                                        OrgeAlexj06O 1 réponse Dernière réponse Répondre Citer 0
                                        • OrgeAlexj06O Hors-ligne
                                          OrgeAlexj06 @robin4002
                                          dernière édition par

                                          @robin4002 Ok, ca a marcher sur la version test d’Eclipse, mais quand je met le mod dans le dossier “mods” de mon serveur, je reçois un crash. Faut-il pas faire en sorte que ce mod soit seulement pour le client et non le serveur ou c’est juste une erreur de ma part. Merci pour ton aide 😉

                                          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 robin4002

                                            Si c’est ça, c’est pour ça qu’il est mieux de le mettre dans le client proxy, qui lui n’est chargé que sur le client.
                                            C’est en plus précisé dans ce tutoriel :

                                            @robin4002 a dit dans Modifier le menu principal :

                                            Afin de faire ceci, nous allons utiliser l’événement GuiOpenEvent pour détecter l’ouverture du GuiMainMenu et ouvrir le nôtre à la place.
                                            Comme les GUIs ne sont que présents sur le client, il va être important de faire ceci dans votre classe client (ClientProxy / NomDuModClient) pour éviter que votre mod fasse crasher le serveur au démarrage.
                                            Dans la classe client, ajoutez donc :

                                            OrgeAlexj06O 2 réponses Dernière réponse Répondre Citer 0
                                            • 1
                                            • 2
                                            • 3
                                            • 4
                                            • 5
                                            • 6
                                            • 7
                                            • 5 / 7
                                            • Premier message
                                              Dernier message
                                            Design by Woryk
                                            ContactMentions Légales

                                            MINECRAFT FORGE FRANCE © 2024

                                            Powered by NodeBB