MFF

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

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

    Planifier Épinglé Verrouillé Déplacé Résolu 1.7.x
    1.7.10
    22 Messages 7 Publieurs 3.1k Vues 4 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.
    • En0ri4nE Hors-ligne
      En0ri4n
      dernière édition par

      Mais ou ? dans le Preinit ?

      Le java c'est comme une boîte de chocolat, on sait jamais sur quoi on va tomber !

      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

        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 réponse Dernière réponse Répondre Citer 0
        • En0ri4nE Hors-ligne
          En0ri4n
          dernière édition par

          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

          Le java c'est comme une boîte de chocolat, on sait jamais sur quoi on va tomber !

          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

            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 réponse Dernière réponse Répondre Citer 0
            • En0ri4nE Hors-ligne
              En0ri4n
              dernière édition par

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

              Le java c'est comme une boîte de chocolat, on sait jamais sur quoi on va tomber !

              1 réponse Dernière réponse Répondre Citer 1
              • Superloup10S Hors-ligne
                Superloup10 Modérateurs
                dernière édition par

                Normal, createbuffer n’existe pas dans la classe ClientProxy

                Si vous souhaitez me faire un don, il vous suffit de cliquer sur le bouton situé en dessous.

                Je suis un membre apprécié et joueur, j'ai déjà obtenu 17 points de réputation.

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

                  mais alors comment le creer alors ?

                  Le java c'est comme une boîte de chocolat, on sait jamais sur quoi on va tomber !

                  1 réponse Dernière réponse Répondre Citer 1
                  • SpyManS Hors-ligne
                    SpyMan
                    dernière édition par 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 réponse Dernière réponse Répondre Citer 1
                    • En0ri4nE Hors-ligne
                      En0ri4n
                      dernière édition par

                      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 ?

                      Le java c'est comme une boîte de chocolat, on sait jamais sur quoi on va tomber !

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

                        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.

                        Si je t'ai filé un coup de main n'oublie pas le + / -
                        Par contre évite les demandes d'aides en MP, tu sera sympa'

                        La JavaDoc c'est comme le PQ, ça sert à ce démerder tous seul. -Victor Hugo- 2017

                        Une superbe API pour animer vos super modèles CraftStudio dans Minecraft !

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

                          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 ?

                          Le java c'est comme une boîte de chocolat, on sait jamais sur quoi on va tomber !

                          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

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

                            1 réponse Dernière réponse Répondre Citer 0
                            • En0ri4nE Hors-ligne
                              En0ri4n
                              dernière édition par 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);
                              
                              	    }
                              	
                                  
                              	
                              	
                              
                              }
                              

                              😭

                              Le java c'est comme une boîte de chocolat, on sait jamais sur quoi on va tomber !

                              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

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

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

                                  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)
                                      {
                                      	
                                      };
                                      
                                  }
                                  
                                  
                                  

                                  Le java c'est comme une boîte de chocolat, on sait jamais sur quoi on va tomber !

                                  A 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

                                    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 réponse Dernière réponse Répondre Citer 0
                                    • A Hors-ligne
                                      arinonia @En0ri4n
                                      dernière édition par

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

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

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

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

                                          MERCI @robin4002, @Superloup10, @SpyMan, @Ama et @arinonia pour vos réponse !
                                          vous ètes super sympa ! 😉 😉 😉

                                          Le java c'est comme une boîte de chocolat, on sait jamais sur quoi on va tomber !

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

                                            Ce message a été supprimé !
                                            1 réponse Dernière réponse Répondre Citer 0
                                            • 1
                                            • 2
                                            • 1 / 2
                                            • Premier message
                                              Dernier message
                                            Design by Woryk
                                            ContactMentions Légales

                                            MINECRAFT FORGE FRANCE © 2024

                                            Powered by NodeBB