Navigation

    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

    SOLVED Comment modifier le nom de la fenetre minecraft et son icone dans la barre des tâches 1.7.10

    1.7.x
    1.7.10
    7
    22
    1245
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Eno_gamer10
      Eno_gamer10 last edited by

      j’aimerai renommer le nom de la fenetre minecraft et son icone mais je ne sais pas comment faire,
      pouvez vous me dire comment faire ?

      1 Reply Last reply Reply Quote 1
      • robin4002
        robin4002 Administrateurs Rédacteurs Moddeurs confirmés last edited by

        Salut,

        Pour le titre de la fenêtre il faut utiliser Display.setName("nouveau nom");
        Et pour l’icône : https://stackoverflow.com/a/12333328

        1 Reply Last reply Reply Quote 0
        • Eno_gamer10
          Eno_gamer10 last edited by

          Mais ou ? dans le Preinit ?

          1 Reply Last reply Reply Quote 1
          • robin4002
            robin4002 Administrateurs Rédacteurs Moddeurs confirmés last edited by

            Il faut simplement que le code soit exécuté une fois, donc le preInit conviendra (d’ailleurs plus ça sera fait tôt, moins longtemps il y aura le logo et le nom de Minecraft).

            Attention par contre à ne pas exécuter ce code côté serveur, sinon ça va le faire crash (le mieux est donc de le mettre dans le client proxy, dans une fonction qui sera appelé depuis le preInit).

            1 Reply Last reply Reply Quote 0
            • Eno_gamer10
              Eno_gamer10 last edited by

              Désolé mais je ne sais pas comment faire,
              Le client proxy :
              Client proxy

              La classe principal :
              text alternatif

              Désolé, je sais que c’est mal fait et que ça pique les yeux

              1 Reply Last reply Reply Quote 1
              • robin4002
                robin4002 Administrateurs Rédacteurs Moddeurs confirmés last edited by

                Dans ton preInit (qui s’appelle actuellement init, ça serait bien de le renommer) il faut mettre proxy.registerRender(); pour appeler la méthode.

                Et dans ton client proxy il faut importer la classe File.

                1 Reply Last reply Reply Quote 0
                • Eno_gamer10
                  Eno_gamer10 last edited by

                  un dernier truc, createbuffer dans le client proxy metundefined for the type ClientProxy
                  et quel file il faut importer ?

                  1 Reply Last reply Reply Quote 1
                  • Superloup10
                    Superloup10 Modérateurs last edited by

                    Normal, createbuffer n’existe pas dans la classe ClientProxy

                    1 Reply Last reply Reply Quote 0
                    • Eno_gamer10
                      Eno_gamer10 last edited by

                      mais alors comment le creer alors ?

                      1 Reply Last reply Reply Quote 1
                      • SpyMan
                        SpyMan last edited by SpyMan

                        il faut lire byte par byte l’image et les mettres ensuite dans le bytebuffer (ce qui correspond a chaque pixel de l’image) mais je crois que ImageIO#read returne une bufferedimage et la bufferedimage a un getter pour retourner un bytebuffer
                        et aussi attention le tu ne peux pas recupérer une image dans un jar avec un file, il faut un inputstream

                        1 Reply Last reply Reply Quote 1
                        • Eno_gamer10
                          Eno_gamer10 last edited by

                          Désolé c’est encore moi ^^
                          J’ai essayer beaucoup de chose mais je n’y arrive toujours pas :’(
                          Vous pourriez m’expliquez en détails ?

                          1 Reply Last reply Reply Quote 1
                          • Ama
                            Ama last edited by

                            Ce bout de code devrait t’aider.

                             public static ByteBuffer createIcon(String path)
                                {
                                    BufferedImage image = null;
                                    try
                                    {
                                        // System.out.print(ClientProxy.class.getResource(path).getPath().replaceAll("%20",
                                        // " ") + "\n");
                                        image = ImageIO.read(ClientProxy.class.getResource(path));
                                        return imageToByteBuffer(image);
                                    }
                                    catch(IOException e)
                                    {
                                        e.printStackTrace();
                                    }
                                    return null;
                                }
                            
                                private static ByteBuffer imageToByteBuffer(BufferedImage image)
                                {
                                    if(image.getType() != BufferedImage.TYPE_INT_ARGB_PRE)
                                    {
                                        BufferedImage convertedImage = new BufferedImage(image.getWidth(), image.getHeight(), BufferedImage.TYPE_INT_ARGB_PRE);
                                        Graphics2D g = convertedImage.createGraphics();
                                        double width = image.getWidth() * (double)1;
                                        double height = image.getHeight() * (double)1;
                                        g.drawImage(image, (int)((convertedImage.getWidth() - width) / 2), (int)((convertedImage.getHeight() - height) / 2), (int)width, (int)height, null);
                                        g.dispose();
                                        image = convertedImage;
                                    }
                            
                                    byte[] imageBuffer = new byte[image.getWidth() * image.getHeight() * 4];
                                    int counter = 0;
                                    for(int i = 0; i < image.getHeight(); i++)
                                        for(int j = 0; j < image.getWidth(); j++)
                                        {
                                            int colorSpace = image.getRGB(j, i);
                                            imageBuffer[counter + 0] = (byte)(colorSpace << 8 >> 24);
                                            imageBuffer[counter + 1] = (byte)(colorSpace << 16 >> 24);
                                            imageBuffer[counter + 2] = (byte)(colorSpace << 24 >> 24);
                                            imageBuffer[counter + 3] = (byte)(colorSpace >> 24);
                                            counter += 4;
                                        }
                                    return ByteBuffer.wrap(imageBuffer);
                                }
                            

                            Dans le client proxy

                            
                                public static ByteBuffer[] icons = new ByteBuffer[2];
                            
                            ClientProxy.icons[0] = createIcon("/assets/" + Utils.MODID_CORE + "/textures/icons/icon16.png"); // 16
                                    ClientProxy.icons[1] = createIcon("/assets/" + Utils.MODID_CORE + "/textures/icons/icon32.png"); // 32
                                    Display.setIcon(ClientProxy.icons);
                            

                            Après, c’est à toi d’y arriver seul.
                            N’oublie pas qu’une bonne recherche google et en anglais de préférence, te donnera la réponse.

                            1 Reply Last reply Reply Quote 0
                            • Eno_gamer10
                              Eno_gamer10 last edited by

                              Merci Ama !
                              Un tout dernier truc 😅
                              pour le nom dde la fenetre c’est a mettre ou ?
                              et ton premier bout de code c’est bien a mettre dans la classe principal ?

                              1 Reply Last reply Reply Quote 1
                              • robin4002
                                robin4002 Administrateurs Rédacteurs Moddeurs confirmés last edited by

                                Dans le client proxy pour les deux, sinon tu vas faire crasher ton serveur.

                                1 Reply Last reply Reply Quote 0
                                • Eno_gamer10
                                  Eno_gamer10 last edited by robin4002

                                  Mon jeu crash :

                                  [09:37:45] [Client thread/INFO] [MinecraftForge]: Attempting early MinecraftForge initialization
                                  [09:37:45] [Client thread/INFO] [FML]: MinecraftForge v10.13.4.1558 Initialized
                                  [09:37:45] [Client thread/INFO] [FML]: Replaced 183 ore recipies
                                  [09:37:46] [Client thread/INFO] [MinecraftForge]: Completed early MinecraftForge initialization
                                  [09:37:48] [Client thread/INFO] [FML]: Found 0 mods from the command line. Injecting into mod discoverer
                                  [09:37:48] [Client thread/INFO] [FML]: Searching C:\Users\Rajo\Desktop\Eno\Dev\forge-directory 3.0\eclipse\mods for mods
                                  [09:38:48] [Client thread/INFO] [FML]: Forge Mod Loader has identified 4 mods to load
                                  [09:38:50] [Client thread/INFO] [FML]: Attempting connection with missing mods [mcp, FML, Forge, MC56] at CLIENT
                                  [09:38:50] [Client thread/INFO] [FML]: Attempting connection with missing mods [mcp, FML, Forge, MC56] at SERVER
                                  [09:38:55] [Client thread/ERROR] [FML]: Attempted to load a proxy type fr.eno.mc56.proxy.ClientProxy into fr.eno.mc56.BaseMod.proxy, but the types don't match
                                  [09:38:55] [Client thread/ERROR] [FML]: An error occured trying to load a proxy into {serverSide=fr.eno.mc56.proxy.CommonProxy, clientSide=fr.eno.mc56.proxy.ClientProxy}.fr.eno.mc56.BaseMod
                                  cpw.mods.fml.common.LoaderException: Attempted to load a proxy type fr.eno.mc56.proxy.ClientProxy into fr.eno.mc56.BaseMod.proxy, but the types don't match
                                  
                                  	at cpw.mods.fml.common.ProxyInjector.inject(ProxyInjector.java:69) [ProxyInjector.class:?]
                                  	at cpw.mods.fml.common.FMLModContainer.constructMod(FMLModContainer.java:512) [FMLModContainer.class:?]
                                  	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_181]
                                  	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_181]
                                  	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_181]
                                  	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_181]
                                  	at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) [guava-17.0.jar:?]
                                  	at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) [guava-17.0.jar:?]
                                  	at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) [guava-17.0.jar:?]
                                  	at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) [guava-17.0.jar:?]
                                  	at com.google.common.eventbus.EventBus.post(EventBus.java:275) [guava-17.0.jar:?]
                                  	at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:212) [LoadController.class:?]
                                  	at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:190) [LoadController.class:?]
                                  	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_181]
                                  	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_181]
                                  	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_181]
                                  	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_181]
                                  	at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) [guava-17.0.jar:?]
                                  	at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) [guava-17.0.jar:?]
                                  	at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) [guava-17.0.jar:?]
                                  	at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) [guava-17.0.jar:?]
                                  	at com.google.common.eventbus.EventBus.post(EventBus.java:275) [guava-17.0.jar:?]
                                  	at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:119) [LoadController.class:?]
                                  	at cpw.mods.fml.common.Loader.loadMods(Loader.java:513) [Loader.class:?]
                                  	at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:208) [FMLClientHandler.class:?]
                                  	at net.minecraft.client.Minecraft.startGame(Minecraft.java:522) [Minecraft.class:?]
                                  	at net.minecraft.client.Minecraft.run(Minecraft.java:942) [Minecraft.class:?]
                                  	at net.minecraft.client.main.Main.main(Main.java:164) [Main.class:?]
                                  	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_181]
                                  	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_181]
                                  	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_181]
                                  	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_181]
                                  	at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]
                                  	at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]
                                  	at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) [start/:?]
                                  	at GradleStart.main(Unknown Source) [start/:?]
                                  [09:38:55] [Client thread/ERROR] [FML]: Fatal errors were detected during the transition from CONSTRUCTING to PREINITIALIZATION. Loading cannot continue
                                  [09:38:55] [Client thread/ERROR] [FML]: 
                                  	States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored
                                  	UC	mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) 
                                  	UC	FML{7.10.99.99} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.4.1558-1.7.10.jar) 
                                  	UC	Forge{10.13.4.1558} [Minecraft Forge] (forgeSrc-1.7.10-10.13.4.1558-1.7.10.jar) 
                                  	UE	MC56{1.0.0} [Mod Minecraft 5.6] (bin) 
                                  [09:38:55] [Client thread/ERROR] [FML]: The following problems were captured during this phase
                                  [09:38:55] [Client thread/ERROR] [FML]: Caught exception from MC56
                                  cpw.mods.fml.common.LoaderException: cpw.mods.fml.common.LoaderException: Attempted to load a proxy type fr.eno.mc56.proxy.ClientProxy into fr.eno.mc56.BaseMod.proxy, but the types don't match
                                  
                                  	at cpw.mods.fml.common.ProxyInjector.inject(ProxyInjector.java:76) ~[forgeSrc-1.7.10-10.13.4.1558-1.7.10.jar:?]
                                  	at cpw.mods.fml.common.FMLModContainer.constructMod(FMLModContainer.java:512) ~[forgeSrc-1.7.10-10.13.4.1558-1.7.10.jar:?]
                                  	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_181]
                                  	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_181]
                                  	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_181]
                                  	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_181]
                                  	at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[guava-17.0.jar:?]
                                  	at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[guava-17.0.jar:?]
                                  	at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[guava-17.0.jar:?]
                                  	at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[guava-17.0.jar:?]
                                  	at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[guava-17.0.jar:?]
                                  	at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:212) ~[forgeSrc-1.7.10-10.13.4.1558-1.7.10.jar:?]
                                  	at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:190) ~[forgeSrc-1.7.10-10.13.4.1558-1.7.10.jar:?]
                                  	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_181]
                                  	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_181]
                                  	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_181]
                                  	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_181]
                                  	at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[guava-17.0.jar:?]
                                  	at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[guava-17.0.jar:?]
                                  	at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[guava-17.0.jar:?]
                                  	at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[guava-17.0.jar:?]
                                  	at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[guava-17.0.jar:?]
                                  	at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:119) [LoadController.class:?]
                                  	at cpw.mods.fml.common.Loader.loadMods(Loader.java:513) [Loader.class:?]
                                  	at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:208) [FMLClientHandler.class:?]
                                  	at net.minecraft.client.Minecraft.startGame(Minecraft.java:522) [Minecraft.class:?]
                                  	at net.minecraft.client.Minecraft.run(Minecraft.java:942) [Minecraft.class:?]
                                  	at net.minecraft.client.main.Main.main(Main.java:164) [Main.class:?]
                                  	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_181]
                                  	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_181]
                                  	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_181]
                                  	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_181]
                                  	at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]
                                  	at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]
                                  	at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) [start/:?]
                                  	at GradleStart.main(Unknown Source) [start/:?]
                                  Caused by: cpw.mods.fml.common.LoaderException: Attempted to load a proxy type fr.eno.mc56.proxy.ClientProxy into fr.eno.mc56.BaseMod.proxy, but the types don't match
                                  
                                  	at cpw.mods.fml.common.ProxyInjector.inject(ProxyInjector.java:69) ~[forgeSrc-1.7.10-10.13.4.1558-1.7.10.jar:?]
                                  	... 35 more
                                  [09:38:55] [Client thread/INFO] [STDOUT]: [net.minecraft.client.Minecraft:displayCrashReport:388]: ---- Minecraft Crash Report ----
                                  // Quite honestly, I wouldn't worry myself about that.
                                  
                                  Time: 04/12/18 09:38
                                  Description: There was a severe problem during mod loading that has caused the game to fail
                                  
                                  cpw.mods.fml.common.LoaderException: cpw.mods.fml.common.LoaderException: Attempted to load a proxy type fr.eno.mc56.proxy.ClientProxy into fr.eno.mc56.BaseMod.proxy, but the types don't match
                                  	at cpw.mods.fml.common.ProxyInjector.inject(ProxyInjector.java:76)
                                  	at cpw.mods.fml.common.FMLModContainer.constructMod(FMLModContainer.java:512)
                                  	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                                  	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                                  	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                                  	at java.lang.reflect.Method.invoke(Unknown Source)
                                  	at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)
                                  	at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
                                  	at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
                                  	at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
                                  	at com.google.common.eventbus.EventBus.post(EventBus.java:275)
                                  	at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:212)
                                  	at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:190)
                                  	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                                  	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                                  	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                                  	at java.lang.reflect.Method.invoke(Unknown Source)
                                  	at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)
                                  	at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
                                  	at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
                                  	at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
                                  	at com.google.common.eventbus.EventBus.post(EventBus.java:275)
                                  	at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:119)
                                  	at cpw.mods.fml.common.Loader.loadMods(Loader.java:513)
                                  	at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:208)
                                  	at net.minecraft.client.Minecraft.startGame(Minecraft.java:522)
                                  	at net.minecraft.client.Minecraft.run(Minecraft.java:942)
                                  	at net.minecraft.client.main.Main.main(Main.java:164)
                                  	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                                  	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                                  	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                                  	at java.lang.reflect.Method.invoke(Unknown Source)
                                  	at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
                                  	at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
                                  	at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source)
                                  	at GradleStart.main(Unknown Source)
                                  Caused by: cpw.mods.fml.common.LoaderException: Attempted to load a proxy type fr.eno.mc56.proxy.ClientProxy into fr.eno.mc56.BaseMod.proxy, but the types don't match
                                  	at cpw.mods.fml.common.ProxyInjector.inject(ProxyInjector.java:69)
                                  	... 35 more
                                  

                                  le client Proxy :

                                  package fr.eno.mc56.proxy;
                                  
                                  import fr.eno.mc56.BaseMod;
                                  import fr.eno.mc56.Reference;
                                  
                                  
                                  import java.awt.Graphics2D;
                                  import java.awt.image.BufferedImage;
                                  import java.io.IOException;
                                  import java.nio.ByteBuffer;
                                  
                                  import javax.imageio.ImageIO;
                                  
                                  import org.jcp.xml.dsig.internal.dom.Utils;
                                  import org.lwjgl.opengl.Display;
                                  
                                  
                                  public class ClientProxy {
                                  	
                                  	public void registerRender()
                                      {
                                          System.out.println("méthode côté client");
                                          Display.setTitle("minecraft 5.6");
                                          
                                      };
                                  	
                                      public static ByteBuffer[] icons = new ByteBuffer[2]; {
                                  
                                      
                                  
                                  ClientProxy.icons[0] = createIcon("/assets/" + Reference.MOD_ID + "/textures/icons/icon16.png"); // 16
                                  
                                          ClientProxy.icons[1] = createIcon("/assets/" + Reference.MOD_ID + "/textures/icons/icon32.png"); // 32
                                  
                                          Display.setIcon(ClientProxy.icons);
                                  }
                                  	
                                  	 public static ByteBuffer createIcon(String path)
                                  
                                  	    {
                                  
                                  	        BufferedImage image = null;
                                  
                                  	        try
                                  
                                  	        {
                                  
                                  	            // System.out.print(ClientProxy.class.getResource(path).getPath().replaceAll("%20",
                                  
                                  	            // " ") + "\n");
                                  
                                  	            image = ImageIO.read(ClientProxy.class.getResource(path));
                                  
                                  	            return imageToByteBuffer(image);
                                  
                                  	        }
                                  
                                  	        catch(IOException e)
                                  
                                  	        {
                                  
                                  	            e.printStackTrace();
                                  
                                  	        }
                                  
                                  	        return null;
                                  
                                  	    }
                                  
                                  	 
                                  
                                  	    private static ByteBuffer imageToByteBuffer(BufferedImage image)
                                  
                                  	    {
                                  
                                  	        if(image.getType() != BufferedImage.TYPE_INT_ARGB_PRE)
                                  
                                  	        {
                                  
                                  	            BufferedImage convertedImage = new BufferedImage(image.getWidth(), image.getHeight(), BufferedImage.TYPE_INT_ARGB_PRE);
                                  
                                  	            Graphics2D g = convertedImage.createGraphics();
                                  
                                  	            double width = image.getWidth() * (double)1;
                                  
                                  	            double height = image.getHeight() * (double)1;
                                  
                                  	            g.drawImage(image, (int)((convertedImage.getWidth() - width) / 2), (int)((convertedImage.getHeight() - height) / 2), (int)width, (int)height, null);
                                  
                                  	            g.dispose();
                                  
                                  	            image = convertedImage;
                                  
                                  	        }
                                  
                                  	 
                                  
                                  	        byte[] imageBuffer = new byte[image.getWidth() * image.getHeight() * 4];
                                  
                                  	        int counter = 0;
                                  
                                  	        for(int i = 0; i < image.getHeight(); i++)
                                  
                                  	            for(int j = 0; j < image.getWidth(); j++)
                                  
                                  	            {
                                  
                                  	                int colorSpace = image.getRGB(j, i);
                                  
                                  	                imageBuffer[counter + 0] = (byte)(colorSpace << 8 >> 24);
                                  
                                  	                imageBuffer[counter + 1] = (byte)(colorSpace << 16 >> 24);
                                  
                                  	                imageBuffer[counter + 2] = (byte)(colorSpace << 24 >> 24);
                                  
                                  	                imageBuffer[counter + 3] = (byte)(colorSpace >> 24);
                                  
                                  	                counter += 4;
                                  
                                  	            }
                                  
                                  	        return ByteBuffer.wrap(imageBuffer);
                                  
                                  	    }
                                  	
                                      
                                  	
                                  	
                                  
                                  }
                                  

                                  😭

                                  1 Reply Last reply Reply Quote 1
                                  • robin4002
                                    robin4002 Administrateurs Rédacteurs Moddeurs confirmés last edited by

                                    Tes paramètres de proxy sur la classe principale ne sont pas bon.

                                    1 Reply Last reply Reply Quote 0
                                    • Eno_gamer10
                                      Eno_gamer10 last edited by

                                      D’accord mais comment je fais alors ? :

                                      public class BaseMod
                                      {
                                      	
                                      	@Instance(Reference.MOD_ID)
                                          public static BaseMod instance;
                                          
                                             
                                      	@SidedProxy(clientSide = "fr.eno.mc56.proxy.ClientProxy", serverSide = "fr.eno.mc56.proxy.CommonProxy")
                                      	public static CommonProxy proxy;
                                      	
                                      	
                                          @EventHandler
                                          public void preinit(FMLPreInitializationEvent event)
                                          {
                                          	proxy.registerRender();	
                                      
                                          };
                                          
                                          @EventHandler
                                          public void init(FMLInitializationEvent event)
                                          {
                                          	
                                          	
                                          };
                                          
                                          @EventHandler
                                          public void postInit(FMLPostInitializationEvent event)
                                          {
                                          	
                                          };
                                          
                                      }
                                      
                                      
                                      
                                      A 1 Reply Last reply Reply Quote 1
                                      • robin4002
                                        robin4002 Administrateurs Rédacteurs Moddeurs confirmés last edited by

                                        Ah autant pour moi j’ai mal lu le message d’erreur, le soucis c’est que ton client proxy d’extends par le proxy common.

                                        1 Reply Last reply Reply Quote 0
                                        • A
                                          arinonia @Eno_gamer10 last edited by

                                          @Pharko
                                          Pourquoi tu met un ; à preInit init et postInit ?

                                          1 Reply Last reply Reply Quote 0
                                          • SpyMan
                                            SpyMan last edited by

                                            le ; est useless ca marque une fin de d’instruction qui n’en n’est pas une

                                            1 Reply Last reply Reply Quote 0
                                            • 1
                                            • 2
                                            • 1 / 2
                                            • First post
                                              Last post
                                            Design by Woryk
                                            Contact / Mentions Légales / Faire un don

                                            MINECRAFT FORGE FRANCE © 2018

                                            Powered by NodeBB