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

      J’imagine que tu as reprit le code depuis ici : https://gist.github.com/robin4002/0bb5f14f0967e78bc5aa0c795410f355

      Il faudrait plutôt repartir du code de la classe GuiMainMenu 1.12.2 de Minecraft et corriger les erreurs comme expliqué :

      Nous allons mettre dans cette classe le même contenu que celui de GuiMainMenu. Pour ouvrir cette classe, afin de copier/coller son contenu, retournez dans la classe client, appuyez sur la touche CTRL et cliquez sur “GuiMainMenu” au niveau de la condition. Alternativement, déroulez le menu “Referenced libraries” puis “forgeSrc-1.11.2-version-de-forge.jar” puis “net.minecraft.client.gui”, vous trouverez GuiMainMenu dans ce package.
      Une fois la classe ouverte, sélectionnez le contenu de celle-ci à partir de la première accolade (celle en dessous de “public class GuiMainMenu extends GuiScreen”) jusqu’à la fin. Copiez le contenu puis collez-le dans votre classe GuiCustomMainMenu, à la place des deux accolades qui étaient présentes.
      Il y aura quelques erreurs à corriger :

      • Commencez par faire ctrl + shift + o pour mettre à jour les importations.
      • Le constructeur sera nommé GuiMainMenu (public GuiMainMenu()) il faut remplacer par GuiCustomMainMenu.
      • Juste au dessus du constructeur, il y aura cette ligne : private net.minecraftforge.client.gui.NotificationModUpdateScreen modUpdateNotification;
      • Retirez-la, c’est en rapport avec le système de vérification de mise à jour de forge, malheureusement nous n’allons pas pouvoir le conserver (car demande en constructeur un GuiMainMenu et non un GuiCustomMainMenu)
      • Retirez les autres lignes :
        modUpdateNotification = net.minecraftforge.client.gui.NotificationModUpdateScreen.init(this, modButton);
        modUpdateNotification.drawScreen(mouseX, mouseY, partialTicks);
      • Forge demande à nouveau un GuiMainMenu pour une fonction, celle qui affiche un splash text spécifique si une ancienne version de java est présente. Retirez-la aussi. (this.splashText = net.minecraftforge.client.ForgeHooksClient.renderMainMenu(this, this.fontRenderer, this.width, this.height, this.splashText);)
      • Dernier problème, une erreur en rapport avec Realms (qui ne nous intéresse pas du tout dans notre cas). Retirez tout le contenu en rapport avec Realms.

      Ou alors tu peux simplement les supprimer, je ne pense pas que tu ais besoin du monde de demo et des avertissement openGL.

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

        @robin4002 merci mes j’ai un nouveau problème le code semble cryptée ici

                this.buttonList.add(new GuiButton(1, this.width / 2 - 100, p_73969_1_, I18n.format("menu.singleplayer")));
                this.buttonList.add(new GuiButton(2, this.width / 2 - 100, p_73969_1_ + p_73969_2_ * 1, I18n.format("menu.multiplayer")));
                this.realmsButton = this.addButton(new GuiButton(14, this.width / 2 + 2, p_73969_1_ + p_73969_2_ * 2, 98, 20, I18n.format("menu.online").replace("Minecraft", "").trim()));
                this.buttonList.add(modButton = new GuiButton(6, this.width / 2 - 100, p_73969_1_ + p_73969_2_ * 2, 98, 20, I18n.format("fml.menu.mods")));
        
        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

          cryptée ? Comment ça x) ? Il n’y a rien de cryptée, les variables ont juste un nom auto-généré par la décompilation qui ne sont pas explicites.

          Regardes où elles sont déclaré et ça devrais être assez simple de comprendre ce qu’elles font.

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

            @robin4002 merci, j’ai un autre souci avec le fichier de lang et je ne trouve pas mon erreur

                    private void addSingleplayerMultiplayerButtons(int p_73969_1_, int p_73969_2_)
                    {
                        this.buttonList.add(new GuiButton(20, 200, 0, I18n.format("menu.localserver")));
                }
            

            en_us.lang

            menu.localserver=Play The Server
            

            69f11b34-efd9-4c26-95b3-d0ebcc191479-image.png

            Merci par avance de votre 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

              Ton fichier en_us.lang se trouve où ?

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

                @robin4002 assets.surfmenu.lang

                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 ton modid c’est bien surfmenu ? Tu as d’autres ressources dans ce mod ou c’est la celle pour l’instant ?

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

                    @robin4002

                    package fr.surfruncraft.surfmenu;
                    
                    import org.apache.logging.log4j.Logger;
                    
                    import net.minecraftforge.fml.common.Mod;
                    import net.minecraftforge.fml.common.Mod.EventHandler;
                    import net.minecraftforge.fml.common.SidedProxy;
                    import net.minecraftforge.fml.common.event.FMLInitializationEvent;
                    import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
                    
                    @Mod(modid = SurfMenu.MODID, name = "SurfMenu", version = "0.1", acceptedMinecraftVersions = "[1.12.2]")
                    public class SurfMenu
                    {
                       public static final String MODID = "surfmenu";
                       public static Logger logger;
                    
                       @SidedProxy(clientSide = "fr.surfruncraft.surfmenu.client.SurfMenuClient", serverSide = "fr.surfruncraft.surfmenu.SurfMenuCommon")
                       public static SurfMenuCommon proxy;
                    
                       @EventHandler
                       public void preInit(FMLPreInitializationEvent event)
                       {
                           SurfMenu.logger = event.getModLog(); // initialise le logger. event.getModLog() retourne un logger avec votre modid
                           SurfMenu.proxy.preInit(event.getSuggestedConfigurationFile());
                       }
                    
                       @EventHandler
                       public void init(FMLInitializationEvent event)
                       {
                           SurfMenu.proxy.init();
                       }
                    }
                    

                    c273d28d-3bc3-47ae-9d7f-c0bfc5eb7f79-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

                      Tout est bon ici.

                      Tu peux essayer de compiler le mod avec gradlew build l’installer et regarder s’il y a le même problème ?
                      Si le problème n’est pas présent sur le mod compilé, c’est un problème avec IDEA qui ne reconnait pas correctement le dossier ressources dans certains cas. (par contre si c’est bien ça je ne connais pas le correctif, je n’utilise pas IDEA).

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

                        @robin4002 sa me semble être idea ;(

                        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

                          https://www.minecraftforgefrance.fr/topic/6207/faire-détecter-le-dossier-ressource-a-l-ide
                          Regardes ce tutoriel

                          surfeur5S 1 réponse Dernière réponse Répondre Citer 0
                          • 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
                                            • 1
                                            • 2
                                            • 3
                                            • 4
                                            • 5
                                            • 6
                                            • 7
                                            • 4 / 7
                                            • Premier message
                                              Dernier message
                                            Design by Woryk
                                            ContactMentions Légales

                                            MINECRAFT FORGE FRANCE © 2024

                                            Powered by NodeBB