Résolu Erreur lors du chargement d'une image minecraft
-
Bonjour;
Avant toute chose j’ai déjà essayé tous ce qui à était sur les sites que je trouvais quand j’écrivais cette erreur sur internet.
Mon problème survient au moment où je me connecte dans minecraft (Solo), l’image ne veut pas s’importer dans minecraft alors que dans le logo du mod l’image elle s’importe bien.
Logiciel: IntelliJ IDEA
Forge: forge-1.12.2-14.23.5.2796-mdkErreur:
[11:33:17] [Client thread/WARN] [minecraft/TextureManager]: Failed to load texture: minecraft:life.png java.io.FileNotFoundException: minecraft:life.png at net.minecraft.client.resources.FallbackResourceManager.getResource(FallbackResourceManager.java:69) ~[FallbackResourceManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.getResource(SimpleReloadableResourceManager.java:65) ~[SimpleReloadableResourceManager.class:?] at net.minecraft.client.renderer.texture.SimpleTexture.loadTexture(SimpleTexture.java:34) ~[SimpleTexture.class:?] at net.minecraft.client.renderer.texture.TextureManager.loadTexture(TextureManager.java:69) [TextureManager.class:?] at net.minecraft.client.renderer.texture.TextureManager.bindTexture(TextureManager.java:44) [TextureManager.class:?] at fr.silvertaurus.GuiClient.GuiLife.renderOverlay(GuiLife.java:16) [GuiLife.class:?] at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_4_GuiLife_renderOverlay_RenderGameOverlayEvent.invoke(.dynamic) [?:?] at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90) [ASMEventHandler.class:?] at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:182) [EventBus.class:?] at net.minecraftforge.client.GuiIngameForge.pre(GuiIngameForge.java:910) [GuiIngameForge.class:?] at net.minecraftforge.client.GuiIngameForge.renderVignette(GuiIngameForge.java:258) [GuiIngameForge.class:?] at net.minecraftforge.client.GuiIngameForge.renderGameOverlay(GuiIngameForge.java:127) [GuiIngameForge.class:?] at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1151) [EntityRenderer.class:?] at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1209) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:442) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_191] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_191] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_191] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_191] 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 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_191] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_191] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_191] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_191] at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?] at GradleStart.main(GradleStart.java:25) [start/:?]
Lancement RunClient:
Code:
package fr.silvertaurus.GuiClient; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.event.RenderGameOverlayEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; public class GuiLife extends GuiScreen { @SubscribeEvent public void renderOverlay(RenderGameOverlayEvent e) { if (e.getType().equals(RenderGameOverlayEvent.ElementType.VIGNETTE)) { Minecraft mc = Minecraft.getMinecraft(); mc.getTextureManager().bindTexture(new ResourceLocation("life.png")); mc.ingameGUI.drawTexturedModalRect(10, 10, 0, 0, 108, 8); } if(e.getType().equals(RenderGameOverlayEvent.ElementType.HEALTH)) { e.setCanceled(true); } } }
Hiérarchie:
[ { "modid": "lifegui", "name": "LifeGUI", "description": "Ajouter une barre de vie.", "version": "${version}", "mcversion": "${mcversion}", "url": "", "updateUrl": "", "authorList": ["silvertaurus"], "credits": "Credit by silvertaurus", "logoFile": "life.png", "screenshots": [], "dependencies": [] } ]
Merci de votre compréhension
-
Non, mais il n’y avait pas besoin de modifier cette ligne
mc.getTextureManager().bindTexture(new ResourceLocation(Reference.MOD_ID, "assets/lifegui/gui/life.png"));
Un ResourceLocation va toujours chercher le fichier dans les dossiersassets/modid
, ensuite, il me semble que tu dois mettremc.getTextureManager().bindTexture(new ResourceLocation(Reference.MOD_ID, "gui/life.png"));
pour qu’il puisse trouver ton fichier. -
Déjà, si je me fis à ton screen, tu dois rajouter un module pour que le run client fonctionne, dans ton cas, c’est celui avec main qu’il faut rajouter.
Ensuite, tu demandes à Minecraft de charger un fichier qu’il ne peut pas trouver dans ses ressources et pour cause, le fichier se trouve dans les ressources de ton mod.
Il faut donc que tu fasses :mc.getTextureManager().bindTexture(new ResourceLocation(tonMod.MODID, "life.png"));
-
Ce message a été supprimé ! -
j’ai toujours cette erreur
[12:24:44] [Client thread/WARN] [minecraft/TextureManager]: Failed to load texture: lifegui:life.png java.io.FileNotFoundException: lifegui:life.png at net.minecraft.client.resources.SimpleReloadableResourceManager.getResource(SimpleReloadableResourceManager.java:69) ~[SimpleReloadableResourceManager.class:?] at net.minecraft.client.renderer.texture.SimpleTexture.loadTexture(SimpleTexture.java:34) ~[SimpleTexture.class:?] at net.minecraft.client.renderer.texture.TextureManager.loadTexture(TextureManager.java:69) [TextureManager.class:?] at net.minecraft.client.renderer.texture.TextureManager.bindTexture(TextureManager.java:44) [TextureManager.class:?] at fr.silvertaurus.GuiClient.GuiLife.renderOverlay(GuiLife.java:17) [GuiLife.class:?] at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_4_GuiLife_renderOverlay_RenderGameOverlayEvent.invoke(.dynamic) [?:?] at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90) [ASMEventHandler.class:?] at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:182) [EventBus.class:?] at net.minecraftforge.client.GuiIngameForge.pre(GuiIngameForge.java:910) [GuiIngameForge.class:?] at net.minecraftforge.client.GuiIngameForge.renderVignette(GuiIngameForge.java:258) [GuiIngameForge.class:?] at net.minecraftforge.client.GuiIngameForge.renderGameOverlay(GuiIngameForge.java:127) [GuiIngameForge.class:?] at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1151) [EntityRenderer.class:?] at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1209) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:442) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_191] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_191] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_191] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_191] 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 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_191] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_191] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_191] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_191] at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?] at GradleStart.main(GradleStart.java:25) [start/:?]
Correction:
package fr.silvertaurus.GuiClient; import fr.silvertaurus.utils.Reference; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.event.RenderGameOverlayEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; public class GuiLife extends GuiScreen { @SubscribeEvent public void renderOverlay(RenderGameOverlayEvent e) { if (e.getType().equals(RenderGameOverlayEvent.ElementType.VIGNETTE)) { Minecraft mc = Minecraft.getMinecraft(); mc.getTextureManager().bindTexture(new ResourceLocation(Reference.MOD_ID,"life.png")); mc.ingameGUI.drawTexturedModalRect(10, 10, 0, 0, 108, 8); } if(e.getType().equals(RenderGameOverlayEvent.ElementType.HEALTH)) { e.setCanceled(true); } } }
Merci pour le module cela me permet enfin de lancer sans avoir une fenêtre d’erreur ^^
-
Je n’avais pas fait attention, mais ton image n’est pas au bon endroit, elle devrait se trouver au minimum ici :
assets/modid
et comme c’est une image de gui, tu devrais la mettre dans un dossiergui
. Les 3 dossiers sont à créer. -
@Superloup10 a dit dans Erreur lors du chargement d'une image minecraft :
assets/modid
Toujours pareil:
[minecraft/TextureManager]: Failed to load texture: lifegui:assets/lifegui/gui/life.png java.io.FileNotFoundException: lifegui:assets/lifegui/gui/life.png at net.minecraft.client.resources.FallbackResourceManager.getResource(FallbackResourceManager.java:69) ~[FallbackResourceManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.getResource(SimpleReloadableResourceManager.java:65) ~[SimpleReloadableResourceManager.class:?] at net.minecraft.client.renderer.texture.SimpleTexture.loadTexture(SimpleTexture.java:34) ~[SimpleTexture.class:?] at net.minecraft.client.renderer.texture.TextureManager.loadTexture(TextureManager.java:69) [TextureManager.class:?] at net.minecraft.client.renderer.texture.TextureManager.bindTexture(TextureManager.java:44) [TextureManager.class:?] at fr.silvertaurus.GuiClient.GuiLife.renderOverlay(GuiLife.java:17) [GuiLife.class:?] at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_4_GuiLife_renderOverlay_RenderGameOverlayEvent.invoke(.dynamic) [?:?] at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90) [ASMEventHandler.class:?] at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:182) [EventBus.class:?] at net.minecraftforge.client.GuiIngameForge.renderHUDText(GuiIngameForge.java:720) [GuiIngameForge.class:?] at net.minecraftforge.client.GuiIngameForge.renderGameOverlay(GuiIngameForge.java:173) [GuiIngameForge.class:?] at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1151) [EntityRenderer.class:?] at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1209) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:442) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_191] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_191] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_191] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_191] 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 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_191] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_191] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_191] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_191] at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?] at GradleStart.main(GradleStart.java:25) [start/:?]
Code:
package fr.silvertaurus.GuiClient; import fr.silvertaurus.utils.Reference; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Gui; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.event.RenderGameOverlayEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; public class GuiLife extends Gui { @SubscribeEvent public void renderOverlay(RenderGameOverlayEvent e) { if (e.getType().equals(RenderGameOverlayEvent.ElementType.TEXT)) { Minecraft mc = Minecraft.getMinecraft(); mc.getTextureManager().bindTexture(new ResourceLocation(Reference.MOD_ID, "assets/lifegui/gui/life.png")); mc.ingameGUI.drawTexturedModalRect(10, 10, 0, 0, 108, 8); } if(e.getType().equals(RenderGameOverlayEvent.ElementType.HEALTH)) { e.setCanceled(true); } } }
Hiérarchie:
-
Non, mais il n’y avait pas besoin de modifier cette ligne
mc.getTextureManager().bindTexture(new ResourceLocation(Reference.MOD_ID, "assets/lifegui/gui/life.png"));
Un ResourceLocation va toujours chercher le fichier dans les dossiersassets/modid
, ensuite, il me semble que tu dois mettremc.getTextureManager().bindTexture(new ResourceLocation(Reference.MOD_ID, "gui/life.png"));
pour qu’il puisse trouver ton fichier. -
C’est exactement cela, je te dis un grand merci, hier j’ai passé une après-midi pour trouver le problème ^^