SOLVED Changer l'icône du jeu / Ressourcelocation, chemin véritable ?


  • Salut !

    J'aimerais avoir charger une image mais sans passer par le

    ResourceLocation("MonMod","textures/gui/MonImage.png");
    

    J'ai cherché sur Internet mais même OpenClassrooms n'a pas répondu à ma question 😶

    Donc j'aimerais charger une image sur ce style,

    ImageIO.read(new File(Minecraft.getMinecraft().mcDataDir.getAbsolutePath() + "\\assets\\altiscraft\\gui\\MonImage.png")
    

    Mais je n'y arrive pas 😕

    (Donc charger une image dans le mod même ;))

    Merci d'avance 😉


  • À moins de rechanger tout le système de gestion des ressources dans MC, la meilleure solution reste d'utiliser de l'OpenGl basique pour afficher ton image. Là au moins tu pourras choisir l'emplacement de ton image à partir du dossier .minecraft
    Et au passage la classe ImageIO, c'est pour afficher des images sur des JFrame ou autres composants issus du package java.awt. Sur un projet lwjgl, tel que MC sa ne marchera pas.


  • Tu vas bien rire mais j'ai regardé le code source de ton Battlefront 2 et j'ai vu les histoires de Display

    Display.setTitle("Star Wars Battlefront II MC EDITION || V 0.1");
    // Display.setResizable(false);
    // Minecraft.getMinecraft().toggleFullscreen();
    //Penser à changer l'icône
    

    Du coup j'ai fais des recherches pour le setIcon mais j'aimerais charger une image png d'une item de mon mod 😄

    https://github.com/Plaigon/Battlefront-2-Minecraft-Mod/blob/master/src/main/java/fr/plaigon/battlefront2/common/core/Battlefront2Mod.java


  • Je comprends pas ce que tu veux faire :

    • charger une texture en dehors de ton mod
    • ou mettre ton item comme icone de fenêtre ?

  • Mettre mon item comme icone de fenêtre 🙂


  • Jai pas la fonction mais regarde du côté de Minecraft pour voir comment qu'il change son icône

  • Correcteurs Moddeurs confirmés

    C'est tout simplement Display.setIcon();. Elle prend un byte buffer en paramètre, regarde sur Google si tu ne sais pas comment faire.


  • @'AymericRed':

    Jai pas la fonction mais regarde du côté de Minecraft pour voir comment qu'il change son icône

    J'ai déjà vu et c'est pas super utile :S

    Et Diabolicatrix c'est mon 1er réflex 😉


  • package net.minecraft.util;
    
    import org.apache.commons.lang3.Validate;
    
    public class ResourceLocation
    {
    private final String resourceDomain;
    private final String resourcePath;
    private static final String __OBFID = "CL_00001082";
    
    public ResourceLocation(String p_i1292_1_, String p_i1292_2_)
    {
    Validate.notNull(p_i1292_2_);
    
    if (p_i1292_1_ != null && p_i1292_1_.length() != 0)
    {
    this.resourceDomain = p_i1292_1_;
    }
    else
    {
    this.resourceDomain = "minecraft";
    }
    
    this.resourcePath = p_i1292_2_;
    }
    
    public ResourceLocation(String p_i1293_1_)
    {
    String s1 = "minecraft";
    String s2 = p_i1293_1_;
    int i = p_i1293_1_.indexOf(58);
    
    if (i >= 0)
    {
    s2 = p_i1293_1_.substring(i + 1, p_i1293_1_.length());
    
    if (i > 1)
    {
    s1 = p_i1293_1_.substring(0, i);
    }
    }
    
    this.resourceDomain = s1.toLowerCase();
    this.resourcePath = s2;
    }
    
    public String getResourcePath()
    {
    return this.resourcePath;
    }
    
    public String getResourceDomain()
    {
    return this.resourceDomain;
    }
    
    public String toString()
    {
    return this.resourceDomain + ":" + this.resourcePath;
    }
    
    public boolean equals(Object p_equals_1_)
    {
    if (this == p_equals_1_)
    {
    return true;
    }
    else if (!(p_equals_1_ instanceof ResourceLocation))
    {
    return false;
    }
    else
    {
    ResourceLocation resourcelocation = (ResourceLocation)p_equals_1_;
    return this.resourceDomain.equals(resourcelocation.resourceDomain) && this.resourcePath.equals(resourcelocation.resourcePath);
    }
    }
    
    public int hashCode()
    {
    return 31 * this.resourceDomain.hashCode() + this.resourcePath.hashCode();
    }
    }
    

    J'arrive vraiment pas 😕 si quelqu'un à des idées, je sèche :S

  • Moddeurs confirmés Rédacteurs Administrateurs

    Mais pourquoi tu tente d'utiliser un ressource location ?
    http://forum.lwjgl.org/index.php?topic=3422.0

  • Correcteurs Moddeurs confirmés

    Premièrement, fais attention aux doubles posts. Ensuite, pourquoi refaire ResourceLocation? Tu n'as pas besoin de ça pour récupérer ton icône. Je te l'ai dit plus haut, ça n'a aucun rapport avec Minecraft ce que tu fais, c'est de l'OpenGL. La seule chose que tu as besoin, c'est d'un ByteBuffer avec tes icônes et tu assignes ton ByteBuffer comme icône: Display.setIcon(ByteBuffer).

    PS: Les tailles des icône changent en fonction du système d'exploitation. C'est pourquoi tu devrais avoir plusieurs icônes (16x16, 32x32, 64x64, 128x128). Quand tu vérifies la desription de setIcon, il est écrit que pour Windows c'est 32x32 ou 64x64, pour Linux c'est 64x64 et pour Mac OS c'est 128x128.

  • Modérateurs

    Display.setIcon(ByteBuffer) est de LWJGL et non d'OpenGL

  • Correcteurs Moddeurs confirmés

    Mon erreur.


  • Voici mon src :

    http://altiscraft.fr/BEN/src.zip

    Je comprends pas, aucune erreur sur Eclipse et ça veut pas gradlew build

    D:\Dossier Benjamin\Installations nouveau PC\Code\Minefus>gradlew build


    Powered By MCP:
    http://modcoderpack.com/
    Searge, ProfMobius, Fesh0r,
    R4wk, ZeuX, IngisKahn, bspkrs
    MCP Data version : unknown


    :compileApiJava UP-TO-DATE
    :processApiResources UP-TO-DATE
    :apiClasses UP-TO-DATE
    :sourceMainJava UP-TO-DATE
    :compileJava
    warning: [options] bootstrap class path not set in conjunction with -source 1.6
    D:\Dossier Benjamin\Installations nouveau PC\Code\Minefus\build\sources\java\fr\minefus\benjaminloison\common\Minefus.java:20: error: package de.matthiasmann.twl.utils does not exist
    import de.matthiasmann.twl.utils.PNGDecoder;
    ^
    D:\Dossier Benjamin\Installations nouveau PC\Code\Minefus\build\sources\java\fr\minefus\benjaminloison\common\Minefus.java:65: error: cannot find symbol
    PNGDecoder decoder = new PNGDecoder(inputStream);
    ^
    symbol: class PNGDecoder
    location: class Minefus
    D:\Dossier Benjamin\Installations nouveau PC\Code\Minefus\build\sources\java\fr\minefus\benjaminloison\common\Minefus.java:65: error: cannot find symbol
    PNGDecoder decoder = new PNGDecoder(inputStream);
    ^
    symbol: class PNGDecoder
    location: class Minefus
    D:\Dossier Benjamin\Installations nouveau PC\Code\Minefus\build\sources\java\fr\minefus\benjaminloison\common\Minefus.java:67: error: package PNGDecoder does not exist
    decoder.decode(bytebuf, decoder.getWidth() * 4, PNGDecoder.Format.RGBA);
    ^
    Note: D:\Dossier Benjamin\Installations nouveau PC\Code\Minefus\build\sources\java\fr\minefus\benjaminloison\gui\GuiCustomMainMenu.java uses unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
    4 errors
    1 warning
    :compileJava FAILED

    FAILURE: Build failed with an exception.

    • What went wrong:
      Execution failed for task ':compileJava'.

    Compilation failed; see the compiler error output for details.

    • Try:
      Run with –stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

    BUILD FAILED

    Total time: 8.773 secs

    D:\Dossier Benjamin\Installations nouveau PC\Code\Minefus>

    J'ai ajouté une libs et je pense que le problème vient de là mais comment le régler 😶 ?

    Merci


  • Oui le problème vient de ta lib. Comment l'as-tu ajouté ? Via le build path de eclipse ? Essaie de déplacer le .jar dans un dossier libs crée à la racine de ta workspace. Sinon si tu as les sources (les .java), rajoute les directement dans ton mod.


  • C'est bon merci 😉

    Juste quand je fais un String d'une ressource image png comme ceci

    String[] ICON_PATHS = { "assets//minefus//textures//gui//16.png", "assets//minefus//textures//gui//32.png",
    "assets//minefus//textures//gui//128.png" };
    

    C'est censé marcher non ??

  • Moddeurs confirmés Rédacteurs Administrateurs

    un seul / pas deux.


  • Toujours un crash :

    [18:11:58] [Client thread/ERROR] [FML]: Fatal errors were detected during the transition from PREINITIALIZATION to INITIALIZATION. Loading cannot continue
    [18:11:58] [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
    UCH mcp{9.05} [Minecraft Coder Pack] (minecraft.jar)
    UCH FML{7.10.99.99} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.4.1492-1.7.10.jar)
    UCH Forge{10.13.4.1492} [Minecraft Forge] (forgeSrc-1.7.10-10.13.4.1492-1.7.10.jar)
    UCH CodeChickenCore{1.0.4.29} [CodeChicken Core] (minecraft.jar)
    UCE minefus.MODID{1.0.0} [Minefus] (bin)
    UCH CarpentersBlocks{3.3.5} [Carpenter's Blocks] (Carpenters.jar)
    UCH customnpcs{1.7.10c} [CustomNpcs] (CustomNPCs_1.7.10b.jar)
    UCH tutoMod{1.0} [Mod de Tuto] (Docraft-1.0.jar)
    UCH custommenu{1.1.0} [Custom Menu] (Docraft-1.0.jar)
    UCH gvc{0.6.1} [�aGliby's�f Voice Chat Mod] (GlibysVC-1.7.10-0.6.2a.jar)
    [18:11:58] [Client thread/ERROR] [FML]: The following problems were captured during this phase
    [18:11:58] [Client thread/ERROR] [FML]: Caught exception from minefus.MODID
    java.lang.NullPointerException
    at org.lwjgl.opengl.Display.setIcon(Display.java:1222) ~[lwjgl-2.9.1.jar:?]
    at fr.minefus.benjaminloison.common.Minefus.preInit(Minefus.java:56) ~[bin/:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_66]
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_66]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_66]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_66]
    at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:532) ~[forgeSrc-1.7.10-10.13.4.1492-1.7.10.jar:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_66]
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_66]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_66]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_66]
    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.1492-1.7.10.jar:?]
    at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:190) ~[forgeSrc-1.7.10-10.13.4.1492-1.7.10.jar:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_66]
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_66]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_66]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_66]
    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.preinitializeMods(Loader.java:556) [Loader.class:?]
    at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:243) [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_66]
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_66]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_66]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_66]
    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/:?]
    [18:11:58] [Client thread/INFO] [STDOUT]: [net.minecraft.client.Minecraft:displayCrashReport:388]: –-- Minecraft Crash Report ----
    // You're mean.

    Time: 07/03/16 18:11
    Description: Initializing game

    java.lang.NullPointerException: Initializing game
    at org.lwjgl.opengl.Display.setIcon(Display.java:1222)
    at fr.minefus.benjaminloison.common.Minefus.preInit(Minefus.java:56)
    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 cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:532)
    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.preinitializeMods(Loader.java:556)
    at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:243)
    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)

    A detailed walkthrough of the error, its code path and all known details is as follows:

    -- Head --
    Stacktrace:
    at org.lwjgl.opengl.Display.setIcon(Display.java:1222)
    at fr.minefus.benjaminloison.common.Minefus.preInit(Minefus.java:56)
    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 cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:532)
    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.preinitializeMods(Loader.java:556)
    at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:243)
    at net.minecraft.client.Minecraft.startGame(Minecraft.java:522)

    -- Initialization --
    Details:
    Stacktrace:
    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)

    -- System Details --
    Details:
    Minecraft Version: 1.7.10
    Operating System: Windows 10 (amd64) version 10.0
    Java Version: 1.8.0_66, Oracle Corporation
    Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
    Memory: 704741928 bytes (672 MB) / 1037959168 bytes (989 MB) up to 1037959168 bytes (989 MB)
    JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
    AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
    IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
    FML: MCP v9.05 FML v7.10.99.99 Minecraft Forge 10.13.4.1492 10 mods loaded, 10 mods active
    States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored
    UCH mcp{9.05} [Minecraft Coder Pack] (minecraft.jar)
    UCH FML{7.10.99.99} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.4.1492-1.7.10.jar)
    UCH Forge{10.13.4.1492} [Minecraft Forge] (forgeSrc-1.7.10-10.13.4.1492-1.7.10.jar)
    UCH CodeChickenCore{1.0.4.29} [CodeChicken Core] (minecraft.jar)
    UCE minefus.MODID{1.0.0} [Minefus] (bin)
    UCH CarpentersBlocks{3.3.5} [Carpenter's Blocks] (Carpenters.jar)
    UCH customnpcs{1.7.10c} [CustomNpcs] (CustomNPCs_1.7.10b.jar)
    UCH tutoMod{1.0} [Mod de Tuto] (Docraft-1.0.jar)
    UCH custommenu{1.1.0} [Custom Menu] (Docraft-1.0.jar)
    UCH gvc{0.6.1} [�aGliby's�f Voice Chat Mod] (GlibysVC-1.7.10-0.6.2a.jar)
    GL info: ' Vendor: 'Intel' Version: '4.3.0 - Build 10.18.15.4256' Renderer: 'Intel(R) HD Graphics 4600'
    Launched Version: 1.7.10
    LWJGL: 2.9.1
    OpenGL: Intel(R) HD Graphics 4600 GL version 4.3.0 - Build 10.18.15.4256, Intel
    GL Caps: Using GL 1.3 multitexturing.
    Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported.
    Anisotropic filtering is supported and maximum anisotropy is 16.
    Shaders are available because OpenGL 2.1 is supported.

    Is Modded: Definitely; Client brand changed to 'fml,forge'
    Type: Client (map_client.txt)
    Resource Packs: []
    Current Language: Français (France)
    Profiler Position: N/A (disabled)
    Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
    Anisotropic Filtering: Off (1)
    [18:11:58] [Client thread/INFO] [STDOUT]: [net.minecraft.client.Minecraft:displayCrashReport:398]: #@!@# Game crashed! Crash report saved to: #@!@# D:\Dossier Benjamin\Installations nouveau PC\Code\Minefus\eclipse.\crash-reports\crash-2016-03-07_18.11.58-client.txt
    Java HotSpot(TM) 64-Bit Server VM warning: Using incremental CMS is deprecated and will likely be removed in a future release

    Ma classe :

    package fr.minefus.benjaminloison.common;
    
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.IOException;
    import java.io.InputStream;
    import java.nio.ByteBuffer;
    
    import org.lwjgl.opengl.Display;
    
    import com.google.common.base.Throwables;
    
    import cpw.mods.fml.common.FMLCommonHandler;
    import cpw.mods.fml.common.Mod;
    import cpw.mods.fml.common.SidedProxy;
    import cpw.mods.fml.common.event.FMLInitializationEvent;
    import cpw.mods.fml.common.event.FMLPostInitializationEvent;
    import cpw.mods.fml.common.event.FMLPreInitializationEvent;
    import cpw.mods.fml.relauncher.Side;
    import de.matthiasmann.twl.utils.PNGDecoder;
    import fr.minefus.benjaminloison.events.ForgeT4EventHandler;
    import fr.minefus.benjaminloison.proxy.CommonProxy;
    import fr.minefus.benjaminloison.proxy.RenderTickHandler;
    import net.minecraft.client.Minecraft;
    import net.minecraftforge.common.MinecraftForge;
    
    @Mod(modid = "minefus.MODID", name = "Minefus", version = "1.0.0")
    public class Minefus {
    public static final String MODID = "minefus";
    @Mod.Instance("minefus.MODID")
    public static Minefus instance;
    @SidedProxy(clientSide = "fr.minefus.benjaminloison.proxy.ClientProxy", serverSide = "fr.minefus.benjaminloison.proxy.CommonProxy")
    public static CommonProxy proxy;
    
    String[] ICON_PATHS = { "assets/minefus/textures/gui/16.png", "assets/minefus/textures/gui/32.png",
    "assets/minefus/textures/gui/128.png" };
    
    @Mod.EventHandler
    public void preInit(FMLPreInitializationEvent event) throws IOException {
    if ((event.getSide().isClient()) && (!Minecraft.getMinecraft().mcDataDir.getAbsolutePath().contains("Minefus"))
    && (!Minecraft.getMinecraft().mcDataDir.equals(new File(".")))) {
    Throwables.propagate(new Exception("Launcher non autorisé"));
    }
    if (event.getSide() == Side.CLIENT) {
    Display.setTitle("Minefus");
    ByteBuffer[] icon_array = new ByteBuffer[ICON_PATHS.length];
    try {
    for (int i = 0; i < ICON_PATHS.length; i++) {
    icon_array* = ByteBuffer.allocateDirect(1);
    String path = ICON_PATHS*;
    icon_array* = loadIcon(path);
    }
    } catch (IOException e) {
    e.printStackTrace();
    }
    Display.setIcon(icon_array);
    }
    
    }
    
    private static ByteBuffer loadIcon(String path) throws IOException {
    InputStream inputStream = new FileInputStream(path);
    try {
    PNGDecoder decoder = new PNGDecoder(inputStream);
    ByteBuffer bytebuf = ByteBuffer.allocateDirect(decoder.getWidth() * decoder.getHeight() * 4);
    decoder.decode(bytebuf, decoder.getWidth() * 4, PNGDecoder.Format.RGBA);
    bytebuf.flip();
    return bytebuf;
    } finally {
    inputStream.close();
    }
    }
    
    @Mod.EventHandler
    public void init(FMLInitializationEvent event) {
    MinecraftForge.EVENT_BUS.register(new ForgeT4EventHandler());
    if (event.getSide().isClient()) {
    FMLCommonHandler.instance().bus().register(new RenderTickHandler(Minecraft.getMinecraft()));
    }
    }
    
    @Mod.EventHandler
    public void postInit(FMLPostInitializationEvent event) {
    }
    }
    

    Et il y a bien les images au bonne endroit*

  • Moddeurs confirmés Rédacteurs Administrateurs

    NPE dans la fonction setIcon, à mon avis il n'arrive pas à lire correctement le logo.


  • Je me dis bien comme lorsque je met un chemin absolu avec C:… ça marche... mais j'aimerais ne pas à avoir d'autres fichiers (images) hors de mon mod pour les logos et que tout soit contenu dans le .jar