Résolu Afficher une image lors de la connexion.
-
D’acc
edit: le gui ne s’affiche toujours pas.
pas de soucis ici ??:
p```java
ublic class EquipeGuiScreen extends GuiScreen{private ResourceLocation ressource = new ResourceLocation(“wl:textures/gui/Equipe.png”);
public EquipeGuiScreen() {
}
@Override
public void initGui() {
super.initGui();
}@Override
protected void keyTyped(char typedChar, int keyCode) throws IOException {
super.keyTyped(typedChar, keyCode);
}@Override
protected void actionPerformed(GuiButton button) throws IOException {
super.actionPerformed(button);
}@Override
public void updateScreen() {
super.updateScreen();
}@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {this.drawDefaultBackground();
mc.getTextureManager().bindTexture(ressource);
this.drawTexturedModalRect(this.width, this.height, 0, 0, 256, 256);
super.drawScreen(mouseX, mouseY, partialTicks);
}}
-
Tu commence à dessiner ton gui en dehors de l’écran, normal que ça marche pas ^^ “this.drawTexturedModalRect(this.width, this.height, 0, 0, 256, 256);”
-
Ouais effectivement merci mais j’ai un dernier soucis en gros lorsque je me connecte sa m’affiche le gui mais même pas une seconde après il se referme .
C’est surement du a l’event que j’utilise: Déclenché lorsqu’un joueur est sur le point de se connecté au serveur
Y’a t’il un autre event que celui la j’ai essayer EntityJoinWorldEvent mon jeu crash et l’image s’affiche même pas une seconde également. -
Il y a un event de fml lorsque le joueur se connecte (PlayerEvent.PlayerLoggedInEvent)
-
Pareil il se referme de suite.
-
Le gui tu demandes de l’ouvrir côté serveur ou client ? Essaie côté serveur de demander l’ouverture
-
Côté client j’essaye côté serveur
-
Marche pas côté serveur rien ne se passe
-
Un peu normal x)
Envoies ton code. -
D’accord^^
Packet:
public class PacketGUI implements IMessage { public PacketGUI() { } public PacketGUI(String text) { } @Override public void fromBytes(ByteBuf buf) { } @Override public void toBytes(ByteBuf buf) { } public static class Handler implements IMessageHandler <packetgui, imessage="">{ @Override public IMessage onMessage(PacketGUI message, MessageContext ctx) { Minecraft.getMinecraft().displayGuiScreen(new EquipeGuiScreen()); return null; } } }
Main:
@EventHandler public void preInit(FMLPreInitializationEvent event){ proxy.preInit(event); //Items: //GameRegister: network = NetworkRegistry.INSTANCE.newSimpleChannel("wl:"); network.registerMessage(PacketGUI.Handler.class, PacketGUI.class, 0, Side.SERVER); } @EventHandler public void init(FMLInitializationEvent event) { proxy.init(event); //Register Event: FMLCommonHandler.instance().bus().register(new Events()); }
Event;
@SubscribeEvent public void PlayerJoin(PlayerEvent.PlayerLoggedInEvent event){ EntityPlayerMP player = (EntityPlayerMP) event.player; WasteLandMod.network.sendToServer(new PacketGUI()); ```</packetgui,>
-
network.registerMessage(PacketGUI.Handler.class, PacketGUI.class, 0, Side.SERVER);
->
network.registerMessage(PacketGUI.Handler.class, PacketGUI.class, 0, Side.CLIENT);
C’est le client qui reçoit le paquet donc il faut mettre client. -
Toujours rien… mais quand j’envoie le packet au client dans l’event ça marche mais il se ferme quelque seconde après…
-
Oui j’avais comprit. Il faut chercher pourquoi il se ferme.
ça va être difficile à déboguer ça. -
Ah bah essayer de votre côté voir car la je comprend pas trop le soucis .
-
Pour déboguer tu peux créer un Throwable que tu vas afficher dans la console dans la fonction où le gui se ferme :
public void laFonctionEnQuestion() { Throwable t = new Throwable(); t.printStackTrace(); }
ça t’affichera par quelle classe cette fonction a été appelée ou alors tu peux passer en debug et mettre un point d’arrêt dans la fonction et voir comment la fonction est appelée
-
Salut, merci de ta réponse SCAREX,
Quand je lance mon jeu en débug lorsque je me connecte en solo mon jeu plante et m’indique que le soucis vient de la:
@Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { this.drawDefaultBackground(); // ICI mc.getTextureManager().bindTexture(ressource); this.drawTexturedModalRect(this.width / 2 - 128, this.height / 2 - 128, 0, 0, 1920, 1080); super.drawScreen(mouseX, mouseY, partialTicks); } }
quand j’enlève cette ligne le crash n’est plus la mais comme avant le gui se ferme directement après .
-
Ta fonction onGuiClosed est appelée par quelle fonction du coup ?
-
Justement j’ai pas de fonction onguiclosed je crois je vérifie ça je te dis.
Edit:
Quand je met cette fonction:
@Override public void onGuiClosed() { Throwable t = new Throwable(); t.printStackTrace(); }
J’ai ça dans les logs:
[13:34:30] [main/INFO] [GradleStart]: Extra: [] [13:34:30] [main/INFO] [GradleStart]: Running with arguments: [–userProperties, {}, --assetsDir, C:/Users/Admin/.gradle/caches/minecraft/assets, --assetIndex, 1.8, --accessToken, {REDACTED}, --version, 1.8, --tweakClass, net.minecraftforge.fml.common.launcher.FMLTweaker, --tweakClass, net.minecraftforge.gradle.tweakers.CoremodTweaker] [13:34:30] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker [13:34:30] [main/INFO] [LaunchWrapper]: Using primary tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker [13:34:30] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.CoremodTweaker [13:34:30] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLTweaker [13:34:30] [main/INFO] [FML]: Forge Mod Loader version 8.0.37.1334 for Minecraft 1.8 loading [13:34:30] [main/INFO] [FML]: Java is Java HotSpot(TM) Client VM, version 1.8.0_45, running on Windows 7:x86:6.1, installed at C:\Program Files (x86)\Java\jdk1.8.0_45\jre [13:34:30] [main/INFO] [FML]: Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation [13:34:30] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.CoremodTweaker [13:34:30] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.fml.relauncher.FMLCorePlugin [13:34:30] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.classloading.FMLForgePlugin [13:34:30] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker [13:34:30] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLDeobfTweaker [13:34:30] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.AccessTransformerTweaker [13:34:30] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker [13:34:30] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker [13:34:30] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper [13:34:30] [main/ERROR] [FML]: The binary patch set is missing. Either you are in a development environment, or things are not going to work! [13:34:31] [main/ERROR] [FML]: FML appears to be missing any signature data. This is not a good thing [13:34:31] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper [13:34:31] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLDeobfTweaker [13:34:31] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.AccessTransformerTweaker [13:34:31] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.TerminalTweaker [13:34:31] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.TerminalTweaker [13:34:31] [main/INFO] [LaunchWrapper]: Launching wrapped minecraft {net.minecraft.client.main.Main} [13:34:31] [Client thread/INFO]: Setting user: Player392 [13:34:33] [Client thread/INFO]: LWJGL Version: 2.9.1 [13:34:33] [Client thread/INFO] [MinecraftForge]: Attempting early MinecraftForge initialization [13:34:33] [Client thread/INFO] [FML]: MinecraftForge v11.14.1.1334 Initialized [13:34:33] [Client thread/INFO] [FML]: Replaced 204 ore recipies [13:34:33] [Client thread/INFO] [MinecraftForge]: Completed early MinecraftForge initialization [13:34:33] [Client thread/INFO] [FML]: Searching C:\Users\Admin\Desktop\Modding\WasteLand 1.8\eclipse\mods for mods [13:34:33] [Client thread/INFO] [FML]: Forge Mod Loader has identified 4 mods to load [13:34:33] [Client thread/INFO] [FML]: Attempting connection with missing mods [mcp, FML, Forge, wl] at CLIENT [13:34:33] [Client thread/INFO] [FML]: Attempting connection with missing mods [mcp, FML, Forge, wl] at SERVER [13:34:34] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:WasteLand [13:34:34] [Client thread/INFO] [FML]: Processing ObjectHolder annotations [13:34:34] [Client thread/INFO] [FML]: Found 384 ObjectHolder annotations [13:34:34] [Client thread/INFO] [FML]: Configured a dormant chunk cache size of 0 [13:34:34] [Client thread/INFO] [FML]: Applying holder lookups [13:34:34] [Client thread/INFO] [FML]: Holder lookups applied [13:34:34] [Sound Library Loader/INFO]: Starting up SoundSystem… [13:34:34] [Thread-6/INFO]: Initializing LWJGL OpenAL [13:34:34] [Thread-6/INFO]: (The LWJGL binding of OpenAL. For more information, see http://www.lwjgl.org) [13:34:34] [Thread-6/INFO]: OpenAL initialized. [13:34:34] [Sound Library Loader/INFO]: Sound engine started [13:34:35] [Client thread/INFO]: Created: 512x512 textures-atlas [13:34:35] [Client thread/INFO] [FML]: Forge Mod Loader has successfully loaded 4 mods [13:34:35] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:WasteLand [13:34:35] [Client thread/INFO]: SoundSystem shutting down… [13:34:36] [Client thread/WARN]: Author: Paul Lamb, www.paulscode.com [13:34:36] [Sound Library Loader/INFO]: Starting up SoundSystem… [13:34:36] [Thread-8/INFO]: Initializing LWJGL OpenAL [13:34:36] [Thread-8/INFO]: (The LWJGL binding of OpenAL. For more information, see http://www.lwjgl.org) [13:34:36] [Thread-8/INFO]: OpenAL initialized. [13:34:36] [Sound Library Loader/INFO]: Sound engine started [13:34:37] [Client thread/INFO]: Created: 512x512 textures-atlas [13:34:39] [Server thread/INFO]: Starting integrated minecraft server version 1.8 [13:34:39] [Server thread/INFO]: Generating keypair [13:34:39] [Server thread/INFO] [FML]: Injecting existing block and item data into this server instance [13:34:39] [Server thread/INFO] [FML]: Applying holder lookups [13:34:39] [Server thread/INFO] [FML]: Holder lookups applied [13:34:39] [Server thread/INFO] [FML]: Loading dimension 0 (New World) (net.minecraft.server.integrated.IntegratedServer@1515cf3) [13:34:39] [Server thread/INFO] [FML]: Loading dimension 1 (New World) (net.minecraft.server.integrated.IntegratedServer@1515cf3) [13:34:39] [Server thread/INFO] [FML]: Loading dimension -1 (New World) (net.minecraft.server.integrated.IntegratedServer@1515cf3) [13:34:39] [Server thread/INFO]: Preparing start region for level 0 [13:34:40] [Server thread/INFO]: Changing view distance to 16, from 10 [13:34:40] [Netty Local Client IO #0/INFO] [FML]: Server protocol version 1 [13:34:40] [Netty Server IO #1/INFO] [FML]: Client protocol version 1 [13:34:40] [Netty Server IO #1/INFO] [FML]: Client attempting to join with 4 mods : FML@8.0.37.1334,wl@1.0,Forge@11.14.1.1334,mcp@9.05 [13:34:40] [Netty Local Client IO #0/INFO] [FML]: [Netty Local Client IO #0] Client side modded connection established [13:34:40] [Server thread/INFO] [FML]: [Server thread] Server side modded connection established [13:34:40] [Server thread/INFO]: Player392[local:E:411625b4] logged in with entity id 337 at (164.8324583551484, 95.0, 5.604756747048976) [13:34:40] [Server thread/INFO]: Player392 joined the game [13:34:41] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: java.lang.Throwable [13:34:41] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: at net.armacraft.GUI.EquipeGuiScreen.onGuiClosed(EquipeGuiScreen.java:52) [13:34:41] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: at net.minecraft.client.Minecraft.displayGuiScreen(Minecraft.java:959) [13:34:41] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: at net.minecraft.client.network.NetHandlerPlayClient.handlePlayerPosLook(NetHandlerPlayClient.java:721) [13:34:41] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: at net.minecraft.network.play.server.S08PacketPlayerPosLook.func_180718_a(S08PacketPlayerPosLook.java:64) [13:34:41] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: at net.minecraft.network.play.server.S08PacketPlayerPosLook.processPacket(S08PacketPlayerPosLook.java:78) [13:34:41] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:24) [13:34:41] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [13:34:41] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: at java.util.concurrent.FutureTask.run(FutureTask.java:266) [13:34:41] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:709) [13:34:41] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1070) [13:34:41] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: at net.minecraft.client.Minecraft.run(Minecraft.java:376) [13:34:41] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: at net.minecraft.client.main.Main.main(Main.java:117) [13:34:41] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [13:34:41] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [13:34:41] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [13:34:41] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: at java.lang.reflect.Method.invoke(Method.java:497) [13:34:41] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [13:34:41] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [13:34:41] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) [13:34:41] [Client thread/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: at GradleStart.main(Unknown Source) [13:34:41] [Server thread/INFO]: Saving and pausing game… [13:34:41] [Server thread/INFO]: Saving chunks for level 'New World'/Overworld [13:34:41] [Server thread/INFO]: Saving chunks for level 'New World'/Nether [13:34:41] [Server thread/INFO]: Saving chunks for level 'New World'/The End
Pour info la ligne 52 de la classe EquipeGuiScreen c’est elle:
@Override public void onGuiClosed() { Throwable t = new Throwable();//Elle t.printStackTrace(); }
-
Tu peux m’envoyer un zip de ton dossier src ? je vais regarder de mon côté.
-
Tien: