Mod avec GuiTextField
-
Je pose ou sa
int posX = (this.width - guiWidth) / 2; int posY = (this.height - guiHeight) / 2;
Entre quoi et quoi
package fr.theazkaze.client.custommenu; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.GuiTextField; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; public class Login extends GuiScreen { private static final int width = 0; private static final int height = 0; private FontRenderer fontRendererObj; public void initGui() { this.textfield = new GuiTextField(this.fontRendererObj, this.width / 2 - 68, this.height / 2 -75, 100, 20); textfield.setMaxStringLength(10); textfield.setText(""); ((GuiTextField) this.textfield).setFocused(true); } protected void keyTyped(char par1, int par2) { super.keyTyped(par1, par2); this.textfield.textboxKeyTyped(par1, par2); } protected void mouseClicked(int x, int y, int btn) { super.mouseClicked(x, y, btn); this.textfield.mouseClicked(x, y, btn); } @Override public void drawScreen(int x, int y, float ticks ) { int guix =(width - guiWidth) /2 ; int guiy =(height - guiHeight) /2; GL11.glColor4f(1,1,1,1); drawDefaultBackground(); mc.renderEngine.bindTexture(new ResourceLocation(MenuCrack.MODID,"textures/gui/guiTest.png")); // Le chemin de ton GUI drawTexturedModalRect(guix, guiy, 0, 0, guiWidth, guiHeight); this.drawDefaultBackground(); this.textfield.drawTextBox(); // On met ton textfield ici super.drawScreen(x, y, ticks); } public void updateScreen() { super.updateScreen(); } @Override public boolean doesGuiPauseGame() { return false; } private GuiTextField textfield; }
-
Entre extends et GuiScreen !
Essaie au moins de comprendre le code avant de demander. Si tu comprends pas, demandes des explications, ce sera toujours mieux que d’énerver le forum en demandant où se place le code, après autant dire que l’auteur de ton mod c’est le forum MinecrafForgeFrance.
-
public class Login extends int posX = (this.width - guiWidth) / 2; int posY = (this.height - guiHeight) / 2;GuiScreen
Se code n’est oas bon
-
Oui, ce que j’ai mis était ironique, ce qui confirme ce que je disais, tu ne cherches pas à comprendre le code, tu le copie direct.
-
package fr.theazkaze.client.custommenu; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.GuiTextField; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; public class Login extends GuiScreen { int guiWidth= 250; // Taille du gui (largeur) int guiHeight= 250;// Taille du gui (hauteur) private static final int width = 0; private static final int height = 0; private FontRenderer fontRendererObj; public void initGui() { this.textfield = new GuiTextField(this.fontRendererObj, this.width / 2 - 68, this.height / 2 -75, 100, 20); textfield.setMaxStringLength(10); textfield.setText(""); ((GuiTextField) this.textfield).setFocused(true); } protected void keyTyped(char par1, int par2) { super.keyTyped(par1, par2); this.textfield.textboxKeyTyped(par1, par2); } protected void mouseClicked(int x, int y, int btn) { super.mouseClicked(x, y, btn); this.textfield.mouseClicked(x, y, btn); } @Override public void drawScreen(int x, int y, float ticks ) { int guix =(width - guiWidth) /2 ; int guiy =(height - guiHeight) /2; GL11.glColor4f(1,1,1,1); drawDefaultBackground(); mc.renderEngine.bindTexture(new ResourceLocation(MenuCrack.MODID,"textures/gui/guiTest.png")); // Le chemin de ton GUI drawTexturedModalRect(guix, guiy, 0, 0, guiWidth, guiHeight); this.drawDefaultBackground(); this.textfield.drawTextBox(); // On met ton textfield ici super.drawScreen(x, y, ticks); } public void updateScreen() { super.updateScreen(); } @Override public boolean doesGuiPauseGame() { return false; } private GuiTextField textfield; }
L’image ne s’affiche pas en jeux
-
Dans mes log il ne cherche même pas l’image
[23:00:21] [main/INFO] [GradleStart]: Extra: [] [23:00:21] [main/INFO] [GradleStart]: Running with arguments: [–userProperties, {}, --assetsDir, C:/Users/Codeur TheAzkaze/.gradle/caches/minecraft/assets, --assetIndex, 1.7.10, --accessToken, {REDACTED}, --version, 1.7.10, --tweakClass, cpw.mods.fml.common.launcher.FMLTweaker, --tweakClass, net.minecraftforge.gradle.tweakers.CoremodTweaker] [23:00:21] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLTweaker [23:00:21] [main/INFO] [LaunchWrapper]: Using primary tweak class name cpw.mods.fml.common.launcher.FMLTweaker [23:00:21] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.CoremodTweaker [23:00:21] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLTweaker [23:00:21] [main/INFO] [FML]: Forge Mod Loader version 7.10.85.1291 for Minecraft 1.7.10 loading [23:00:21] [main/INFO] [FML]: Java is Java HotSpot(TM) Client VM, version 1.8.0_45, running on Windows 8:x86:6.2, installed at C:\Program Files (x86)\Java\jre1.8.0_45 [23:00:21] [main/INFO] [FML]: Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation [23:00:21] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.CoremodTweaker [23:00:21] [main/INFO] [GradleStart]: Injecting location in coremod cpw.mods.fml.relauncher.FMLCorePlugin [23:00:21] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.classloading.FMLForgePlugin [23:00:21] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker [23:00:21] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLDeobfTweaker [23:00:21] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.AccessTransformerTweaker [23:00:21] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker [23:00:21] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker [23:00:21] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.relauncher.CoreModManager$FMLPluginWrapper [23:00:21] [main/ERROR] [FML]: The binary patch set is missing. Either you are in a development environment, or things are not going to work! [23:00:23] [main/ERROR] [FML]: FML appears to be missing any signature data. This is not a good thing [23:00:23] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.relauncher.CoreModManager$FMLPluginWrapper [23:00:23] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLDeobfTweaker [23:00:23] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.AccessTransformerTweaker [23:00:23] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.TerminalTweaker [23:00:23] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.TerminalTweaker [23:00:23] [main/INFO] [LaunchWrapper]: Launching wrapped minecraft {net.minecraft.client.main.Main} [23:00:24] [main/INFO]: Setting user: Player973 [23:00:26] [Client thread/INFO]: LWJGL Version: 2.9.1 [23:00:28] [Client thread/INFO] [STDOUT]: [tv.twitch.StandardCoreAPI:<init>:16]: If on Windows, make sure to provide all of the necessary dll's as specified in the twitchsdk README. Also, make sure to set the PATH environment variable to point to the directory containing the dll's. [23:00:28] [Client thread/ERROR]: Couldn't initialize twitch stream [23:00:28] [Client thread/INFO] [MinecraftForge]: Attempting early MinecraftForge initialization [23:00:28] [Client thread/INFO] [FML]: MinecraftForge v10.13.2.1291 Initialized [23:00:28] [Client thread/INFO] [FML]: Replaced 183 ore recipies [23:00:28] [Client thread/INFO] [MinecraftForge]: Completed early MinecraftForge initialization [23:00:29] [Client thread/INFO] [FML]: Searching C:\Users\Codeur TheAzkaze\Desktop\Mod pour les button 1.7.10\eclipse\mods for mods [23:00:32] [Client thread/INFO] [FML]: Forge Mod Loader has identified 4 mods to load [23:00:32] [Client thread/INFO] [FML]: Attempting connection with missing mods [mcp, FML, Forge, MenuCrack] at CLIENT [23:00:32] [Client thread/INFO] [FML]: Attempting connection with missing mods [mcp, FML, Forge, MenuCrack] at SERVER [23:00:33] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:MenuCrack [23:00:33] [Client thread/INFO] [FML]: Processing ObjectHolder annotations [23:00:33] [Client thread/INFO] [FML]: Found 341 ObjectHolder annotations [23:00:33] [Client thread/INFO] [FML]: Configured a dormant chunk cache size of 0 [23:00:33] [Client thread/INFO] [FML]: Applying holder lookups [23:00:33] [Client thread/INFO] [FML]: Holder lookups applied [23:00:33] [Sound Library Loader/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: [23:00:33] [Sound Library Loader/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: Starting up SoundSystem… [23:00:33] [Thread-6/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: Initializing LWJGL OpenAL [23:00:33] [Thread-6/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: (The LWJGL binding of OpenAL. For more information, see http://www.lwjgl.org) [23:00:33] [Thread-6/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: OpenAL initialized. [23:00:34] [Sound Library Loader/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: [23:00:34] [Sound Library Loader/INFO]: Sound engine started [23:00:36] [Client thread/INFO]: Created: 512x256 textures/blocks-atlas [23:00:37] [Client thread/INFO]: Created: 256x256 textures/items-atlas [23:00:37] [Client thread/INFO] [STDOUT]: [fr.theazkaze.client.custommenu.MenuCrack:init:31]: DIRT BLOCK >> tile.dirt [23:00:37] [Client thread/INFO] [FML]: Forge Mod Loader has successfully loaded 4 mods [23:00:37] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:MenuCrack [23:00:37] [Client thread/INFO]: Created: 512x256 textures/blocks-atlas [23:00:37] [Client thread/INFO]: Created: 256x256 textures/items-atlas [23:00:37] [Client thread/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: [23:00:37] [Client thread/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: SoundSystem shutting down… [23:00:38] [Client thread/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:importantMessage:90]: Author: Paul Lamb, www.paulscode.com [23:00:38] [Client thread/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: [23:00:38] [Sound Library Loader/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: [23:00:38] [Sound Library Loader/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: Starting up SoundSystem… [23:00:38] [Thread-8/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: Initializing LWJGL OpenAL [23:00:38] [Thread-8/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: (The LWJGL binding of OpenAL. For more information, see http://www.lwjgl.org) [23:00:38] [Thread-8/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: OpenAL initialized. [23:00:38] [Sound Library Loader/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: [23:00:38] [Sound Library Loader/INFO]: Sound engine started [23:00:44] [Server thread/INFO]: Starting integrated minecraft server version 1.7.10 [23:00:44] [Server thread/INFO]: Generating keypair [23:00:44] [Server thread/INFO] [FML]: Injecting existing block and item data into this server instance [23:00:44] [Server thread/INFO] [FML]: Applying holder lookups [23:00:44] [Server thread/INFO] [FML]: Holder lookups applied [23:00:45] [Server thread/INFO] [FML]: Loading dimension 0 (New World) (net.minecraft.server.integrated.IntegratedServer@1fa4a91) [23:00:45] [Server thread/INFO] [FML]: Loading dimension 1 (New World) (net.minecraft.server.integrated.IntegratedServer@1fa4a91) [23:00:45] [Server thread/INFO] [FML]: Loading dimension -1 (New World) (net.minecraft.server.integrated.IntegratedServer@1fa4a91) [23:00:45] [Server thread/INFO]: Preparing start region for level 0 [23:00:46] [Server thread/INFO]: Preparing spawn area: 45% [23:00:47] [Server thread/INFO]: Preparing spawn area: 98% [23:00:48] [Server thread/INFO]: Changing view distance to 8, from 10 [23:00:48] [Netty Client IO #0/INFO] [FML]: Server protocol version 1 [23:00:48] [Netty IO #1/INFO] [FML]: Client protocol version 1 [23:00:48] [Netty IO #1/INFO] [FML]: Client attempting to join with 4 mods : FML@7.10.85.1291,Forge@10.13.2.1291,mcp@9.05,MenuCrack@1.0 [23:00:48] [Netty IO #1/INFO] [FML]: Attempting connection with missing mods [] at CLIENT [23:00:48] [Netty Client IO #0/INFO] [FML]: Attempting connection with missing mods [] at SERVER [23:00:48] [Server thread/INFO] [FML]: [Server thread] Server side modded connection established [23:00:48] [Client thread/INFO] [FML]: [Client thread] Client side modded connection established [23:00:48] [Server thread/INFO]: Player973[local:E:c57c1778] logged in with entity id 350 at (-174.5, 65.0, 250.5) [23:00:48] [Server thread/INFO]: Player973 joined the game [23:00:51] [Server thread/INFO]: Saving and pausing game… [23:00:51] [Server thread/INFO]: Saving chunks for level 'New World'/Overworld [23:00:51] [Server thread/INFO]: Saving chunks for level 'New World'/Nether [23:00:51] [Server thread/INFO]: Saving chunks for level 'New World'/The End [23:00:52] [Server thread/INFO]: Stopping server [23:00:52] [Server thread/INFO]: Saving players [23:00:52] [Server thread/INFO]: Saving worlds [23:00:52] [Server thread/INFO]: Saving chunks for level 'New World'/Overworld [23:00:52] [Server thread/INFO]: Saving chunks for level 'New World'/Nether [23:00:52] [Server thread/INFO]: Saving chunks for level 'New World'/The End [23:00:53] [Server thread/INFO] [FML]: Unloading dimension 0 [23:00:53] [Server thread/INFO] [FML]: Unloading dimension -1 [23:00:53] [Server thread/INFO] [FML]: Unloading dimension 1 [23:00:53] [Server thread/INFO] [FML]: Applying holder lookups [23:00:53] [Server thread/INFO] [FML]: Holder lookups applied [23:01:23] [Client thread/INFO]: Stopping! [23:01:23] [Client thread/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: [23:01:23] [Client thread/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: SoundSystem shutting down… [23:01:24] [Client thread/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:importantMessage:90]: Author: Paul Lamb, www.paulscode.com [23:01:24] [Client thread/INFO] [STDOUT]: [paulscode.sound.SoundSystemLogger:message:69]: Java HotSpot(TM) Client VM warning: Using incremental CMS is deprecated and will likely be removed in a future release ```</init>
-
Petit aide SVP
-
Règle du forum : minimum 24 heures entre 2 messages.
Regarde ta réputation, essaie de comprendre le code, et ensuite reviens vers nous : on ne peut pas t’aider si tu ne fais pas d’efforts.
-
Je fais des effort mais je ne comprend pas pourquoi
il ne se relie pas et j’aimerais avoir des explication sur ce fais -
Qui ne se relie pas ?
-
Login ne se relie pas a ma class principale et ne s’affiche pas
donc j’en ai deduis que si je ne voyais rien en jeux x’étais a cause de sa -
Et pourquoi souhaites tu que ces deux classes soient reliées entre elles ?
Après y a quelque chose que je ne comprends pas. Tu souhaites juste qu un joueur qui se log ne puisse pas voir son mdp, c est ça ? Si oui alors tu n as pas besoin de créer un nouveau gui. -
Julot10085 comment fair allor
-
@‘TheAzkaze’:
Julot10085 comment fair allor
Sers toi des event côté client.
Je ne me souviens plus exactement du nom de l event. Sinon sers toi d un event tick du joueur et tu check si le joueur est dans le gui de chat, si oui tu regardes ce qu il est en train d écrire et tout ce qui se trouve après login tu mets sa en ****** -
Tous les événements dont tu as besoin sont extends GuiScreenEvent, regarde dans cette classe.