Modifier le menu principal
-
Ou alors tu peux aussi utiliser l’index du field dans la classe

Sent from my GT-I9000 using Tapatalk 2
-
J’aime pas utiliser les index car ils changent en fonction de la classe mère. Je corrigerais le tuto une fois chez moi (d’ici 3 jours).
-
J’ai fixé le problème d’obfuscation, le tutoriel est valide.
-
c’est quoi la ligne de code pour pouvoir directement rejoindre un serveur?
-
Je crois que c’est FMLCommonHandler. connectToServerAtStartup
Envoyé de mon SM-G920F en utilisant Tapatalk
-
@‘SCAREX’:
Je crois que c’est FMLCommonHandler. connectToServerAtStartup
Envoyé de mon SM-G920F en utilisant Tapat
Tu pourrais appronfondire car cela nous aide pas a créé un bouton qui nous connecte a notre serveur ( Avec une IP )
Merci d’avance j’en ai grandement besoin -
package fr.scarex.tutorialmod.client; /* Ici vont les imports /** * @author SCAREX * */ public class ClientProxy extends CommonProxy { public ClientProxy() { // registering the PROXY to use events from MinecraftForge MinecraftForge.EVENT_BUS.register(this); } /** * This function is called when the init method of a GuiScreen is called and * modify the current buttons and the splash text */ @SubscribeEvent public void onInitGuiEvent(InitGuiEvent.Post event) { if (event.gui instanceof GuiMainMenu) { // On regarde si le gui est bien le menu principal int i = event.gui.height / 4 + 48; // On définit une variable pour simplifier le code (elle est utilisée par Minecraft) event.buttonList.add(new GuiButton(30, event.gui.width / 2 - 100, i + 24 * 2, 100, 20, "Bouton de connexion") { // On crée un bouton avec l'ID 30 de 100 de large et 20 de large @Override public void mouseReleased(int x, int y) { // Lorsque l'on clique FMLClientHandler.connectToServerAtStartup("tonAdresse", lePort); // On lance la connection au serveur } }); } } }Voilà le code qu’il faut, si tu as besoin de plus de détails, n’hésite pas.
-
Merci beaucoup je vais voir si tu m’as avancé dans mon projet

-
[font=monospaceFMLClientHandler][font=monospace.][font=monospaceconnectToServerAtStartup][font=monospace(][font=monospace“tonAdresse”][font=monospace,] lePort[font=monospace);] [font=monospace// On lance la connection au serveur]
Je vois pas ce que tu veut dire pas lePort :/ -
25565 le port par défaut d’un serveur genre adresse_ip : port
-
Cannot make a static reference to the non-static method connectToServerAtStartup(String, int) from the type FMLClientHandler
Voila se que ça me met …
-
FMLClientHandler.instance().connectToServerAtStartup(…);
-
Niquel Merci à vous
–------------------------------------------------------------------
SCAREX sa te dérangerai de m’accorder quelque instant sur skype j’ai quelque truc a te demandé
Merci d’avance -
Bonjour j’ai un problème je ne peux pas ajouter plusieur bouton dans ma class sans qui me mette une erreur . Voila ma class
package com.google.commando24.proxy; import java.awt.Desktop; import java.net.URI; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiMainMenu; import net.minecraft.client.gui.GuiOptions; import net.minecraft.client.gui.GuiScreenResourcePacks; import net.minecraft.client.resources.I18n; import net.minecraftforge.client.event.GuiOpenEvent; import net.minecraftforge.client.event.GuiScreenEvent.ActionPerformedEvent; import net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent; import net.minecraftforge.common.MinecraftForge; import cpw.mods.fml.common.ObfuscationReflectionHelper; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import com.google.commando24.common.ModTEM; public class ClientProxy extends CommonProxy { @Override public void registerRender() { } public ClientProxy() { MinecraftForge.EVENT_BUS.register(this); } @SubscribeEvent public void onInitGuiEvent(InitGuiEvent.Post event) { for(Object b : event.buttonList) { if (((GuiButton) b).id == 0 ) { ((GuiButton) b).visible = false; } } } @SubscribeEvent public void onInitGuiEvent1(InitGuiEvent.Post event) { for(Object b : event.buttonList) { if (((GuiButton) b).id == 1 ) { ((GuiButton) b).visible = false; } } } @SubscribeEvent public void onInitGuiEvent2(InitGuiEvent.Post event) { for(Object b : event.buttonList) { if (((GuiButton) b).id == 4 ) { ((GuiButton) b).visible = false; } } } @SubscribeEvent public void onInitGuiEvent3(InitGuiEvent.Post event) { for(Object b : event.buttonList) { if (((GuiButton) b).id == 14 ) { ((GuiButton) b).visible = false; } } } @SubscribeEvent public void onInitGuiEvent5(InitGuiEvent.Post event) { for(Object b : event.buttonList) { if (((GuiButton) b).id == 6 ) { ((GuiButton) b).visible = false; } } } @SubscribeEvent public void onInitGuiEvent6(InitGuiEvent.Post event) { for(Object b : event.buttonList) { if (((GuiButton) b).id == 2 ) { ((GuiButton) b).visible = false; } } } @SubscribeEvent public void onInitGuiEvent7(InitGuiEvent.Post event) { for(Object b : event.buttonList) { if (((GuiButton) b).id == 5 ) { ((GuiButton) b).visible = false; } }{ int i = event.gui.height / 4 + 48; event.buttonList.add(new GuiButton(30, event.gui.width / 2 - 100, i + 30 * 2, 100, 20, "TeamSpeak") { @Override public void mouseReleased(int x, int y) { if (Desktop.isDesktopSupported()) { try { Desktop.getDesktop().browse(new URI("ts3server://ts.minecraftforgefrance.fr?port=9987")); } catch (Exception e) { } } } }); } } }Il crash si je rajoute un bouton .
-
onInitGuiEvent, onInitGuiEvent2, onInitGuiEvent3 …
C’est sérieux là ?package com.google.commando24.proxy; import java.awt.Desktop; import java.net.URI; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiMainMenu; import net.minecraft.client.gui.GuiOptions; import net.minecraft.client.gui.GuiScreenResourcePacks; import net.minecraft.client.resources.I18n; import net.minecraftforge.client.event.GuiOpenEvent; import net.minecraftforge.client.event.GuiScreenEvent.ActionPerformedEvent; import net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent; import net.minecraftforge.common.MinecraftForge; import cpw.mods.fml.common.ObfuscationReflectionHelper; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import com.google.commando24.common.ModTEM; public class ClientProxy extends CommonProxy { @Override public void registerRender() { } public ClientProxy() { MinecraftForge.EVENT_BUS.register(this); } @SubscribeEvent public void onInitGuiEvent(InitGuiEvent.Post event) { for(Object b : event.buttonList) { int id = ((GuiButton) b).id; if ((id >= 0 && id <= 6) || id == 14) // les conditions fond partie de la base de la programmation !!!!!!! { ((GuiButton) b).visible = false; } } int i = event.gui.height / 4 + 48; event.buttonList.add(new GuiButton(30, event.gui.width / 2 - 100, i + 30 * 2, 100, 20, "TeamSpeak") { @Override public void mouseReleased(int x, int y) { if (Desktop.isDesktopSupported()) { try { Desktop.getDesktop().browse(new URI("ts3server://ts.minecraftforgefrance.fr?port=9987")); } catch (Exception e){} } } }); } } -
Comment on met un grand carré comme celui du solo s’il te plait .
-
Un carré comme en solo ? Tu veux dire changer la taille du bouton ?
event.buttonList.add(new GuiButton(30, event.gui.width / 2 - 100, i + 30 * 2, 100, 20, "TeamSpeak") // Le 100 c'est la largeur (width) et le 20 c'est la hauteur (heigth) -
Bonjour , j’ai un crash de mon mod .
Voila le crash report .–-- Minecraft Crash Report ---- // I'm sorry, Dave. Time: 12/05/16 11:42 Description: Initializing game java.util.ConcurrentModificationException at java.util.ArrayList$Itr.checkForComodification(Unknown Source) at java.util.ArrayList$Itr.next(Unknown Source) at com.google.commando24.proxy.ClientProxy.onInitGuiEvent(ClientProxy.java:34) at cpw.mods.fml.common.eventhandler.ASMEventHandler_0_ClientProxy_onInitGuiEvent_Post.invoke(.dynamic) at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:54) at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:140) at net.minecraft.client.gui.GuiScreen.setWorldAndResolution(GuiScreen.java:296) at net.minecraft.client.Minecraft.displayGuiScreen(Minecraft.java:865) at net.minecraft.client.Minecraft.startGame(Minecraft.java:607) 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 java.util.ArrayList$Itr.checkForComodification(Unknown Source) at java.util.ArrayList$Itr.next(Unknown Source) at com.google.commando24.proxy.ClientProxy.onInitGuiEvent(ClientProxy.java:34) at cpw.mods.fml.common.eventhandler.ASMEventHandler_0_ClientProxy_onInitGuiEvent_Post.invoke(.dynamic) at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:54) at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:140) at net.minecraft.client.gui.GuiScreen.setWorldAndResolution(GuiScreen.java:296) at net.minecraft.client.Minecraft.displayGuiScreen(Minecraft.java:865) at net.minecraft.client.Minecraft.startGame(Minecraft.java:607) -- 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 7 (amd64) version 6.1 Java Version: 1.8.0_91, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 687327208 bytes (655 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 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.1614 4 mods loaded, 4 mods active States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored UCHIJA mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) UCHIJA FML{7.10.99.99} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.4.1614-1.7.10.jar) UCHIJA Forge{10.13.4.1614} [Minecraft Forge] (forgeSrc-1.7.10-10.13.4.1614-1.7.10.jar) UCHIJA ModTEM{1.0.0} [The Evolution Of McDonald] (bin) GL info: ' Vendor: 'Intel' Version: '4.0.0 - Build 10.18.10.3412' Renderer: 'Intel(R) HD Graphics 4000' Launched Version: 1.7.10 LWJGL: 2.9.1 OpenGL: Intel(R) HD Graphics 4000 GL version 4.0.0 - Build 10.18.10.3412, 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)Voila la class principal
package com.google.commando24.common; import com.google.commando24.proxy.CommonProxy; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.Mod.Instance; 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.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; @Mod(modid = "ModTEM", name = "The Evolution Of McDonald", version = "1.0.0") public class ModTEM { private static final Block ModTEM = null; @Instance("ModTEM") public static ModTEM instance; public static Block Barre, Brique, Route, Contour, Murre; @SidedProxy(clientSide = "com.google.commando24.proxy.ClientProxy", serverSide = "com.google.commando24.proxy.CommonProxy") public static CommonProxy proxy; @EventHandler public void preInit(FMLPreInitializationEvent event) { Barre = new Barre(Material.rock).setBlockName("Barre").setBlockTextureName("modtem:barre").setCreativeTab(CreativeTabs.tabFood); Brique = new Brique(Material.rock).setBlockName("Brique").setBlockTextureName("modtem:brique").setCreativeTab(CreativeTabs.tabFood); Route = new Route(Material.rock).setBlockName("Route").setBlockTextureName("modtem:route").setCreativeTab(CreativeTabs.tabFood); Contour = new Contour(Material.rock).setBlockName("Contour").setBlockTextureName("modtem:contour").setCreativeTab(CreativeTabs.tabFood); Murre = new Murre(Material.rock).setBlockName("Murre").setBlockTextureName("modtem:murre").setCreativeTab(CreativeTabs.tabFood); GameRegistry.registerBlock(Barre, "Barre"); GameRegistry.registerBlock(Brique, "Brique"); GameRegistry.registerBlock(Route, "Route"); GameRegistry.registerBlock(Contour, "Contour"); GameRegistry.registerBlock(Murre, "Murre"); } @EventHandler public void Init(FMLInitializationEvent event) { proxy.registerRender(); } @EventHandler public void postInit(FMLPostInitializationEvent event) { } }Mon client proxy
package com.google.commando24.proxy; import java.awt.Desktop; import java.net.URI; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiMainMenu; import net.minecraft.client.gui.GuiOptions; import net.minecraft.client.gui.GuiScreenResourcePacks; import net.minecraft.client.resources.I18n; import net.minecraftforge.client.event.GuiOpenEvent; import net.minecraftforge.client.event.GuiScreenEvent.ActionPerformedEvent; import net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent; import net.minecraftforge.common.MinecraftForge; import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.common.ObfuscationReflectionHelper; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import com.google.commando24.common.ModTEM; public class ClientProxy extends CommonProxy { @Override public void registerRender() { } public ClientProxy() { MinecraftForge.EVENT_BUS.register(this); } @SubscribeEvent public void onInitGuiEvent(final InitGuiEvent.Post event) { if(event.gui instanceof GuiMainMenu) { for(Object b : event.buttonList) { if(((GuiButton)b).id == 0) { ((GuiButton)b).visible = false; } if(((GuiButton)b).id == 0) { ((GuiButton)b).visible = false; } if(((GuiButton)b).id == 2) { ((GuiButton)b).visible = false; } if(((GuiButton)b).id == 4) { ((GuiButton)b).visible = false; } if(((GuiButton)b).id == 5) { ((GuiButton)b).visible = false; } if(((GuiButton)b).id == 6) { ((GuiButton)b).visible = false; } if(((GuiButton)b).id == 14) { ((GuiButton)b).visible = false; } int i = event.gui.height / 4 + 48; event.buttonList.add(new GuiButton(30, event.gui.width / 2 - 100, i + 24 * 2, 100, 20, "AltisLife") { @Override public void mouseReleased(int x, int y) { FMLClientHandler.instance().connectToServerAtStartup("192.168.1.127", 25565); } }); } } } } -
public void onInitGuiEvent(final InitGuiEvent.Post event)
Retires le final ici. -
Il me refait le même crash –-- Minecraft Crash Report ----
// I blame Dinnerbone.Time: 12/05/16 15:53
Description: Initializing gamejava.util.ConcurrentModificationException
at java.util.ArrayList$Itr.checkForComodification(Unknown Source)
at java.util.ArrayList$Itr.next(Unknown Source)
at com.google.commando24.proxy.ClientProxy.onInitGuiEvent(ClientProxy.java:34)
at cpw.mods.fml.common.eventhandler.ASMEventHandler_0_ClientProxy_onInitGuiEvent_Post.invoke(.dynamic)
at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:54)
at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:140)
at net.minecraft.client.gui.GuiScreen.setWorldAndResolution(GuiScreen.java:296)
at net.minecraft.client.Minecraft.displayGuiScreen(Minecraft.java:865)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:607)
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 java.util.ArrayList$Itr.checkForComodification(Unknown Source)
at java.util.ArrayList$Itr.next(Unknown Source)
at com.google.commando24.proxy.ClientProxy.onInitGuiEvent(ClientProxy.java:34)
at cpw.mods.fml.common.eventhandler.ASMEventHandler_0_ClientProxy_onInitGuiEvent_Post.invoke(.dynamic)
at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:54)
at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:140)
at net.minecraft.client.gui.GuiScreen.setWorldAndResolution(GuiScreen.java:296)
at net.minecraft.client.Minecraft.displayGuiScreen(Minecraft.java:865)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:607)– 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 7 (amd64) version 6.1
Java Version: 1.8.0_91, Oracle Corporation
Java VM Version: Java HotSpot
64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 666876768 bytes (635 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 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.1614 4 mods loaded, 4 mods active
States: ‘U’ = Unloaded ‘L’ = Loaded ‘C’ = Constructed ‘H’ = Pre-initialized ‘I’ = Initialized ‘J’ = Post-initialized ‘A’ = Available ‘D’ = Disabled ‘E’ = Errored
UCHIJA mcp{9.05} [Minecraft Coder Pack] (minecraft.jar)
UCHIJA FML{7.10.99.99} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.4.1614-1.7.10.jar)
UCHIJA Forge{10.13.4.1614} [Minecraft Forge] (forgeSrc-1.7.10-10.13.4.1614-1.7.10.jar)
UCHIJA ModTEM{1.0.0} [The Evolution Of McDonald] (bin)
GL info: ’ Vendor: ‘Intel’ Version: ‘4.0.0 - Build 10.18.10.3412’ Renderer: ‘Intel
HD Graphics 4000’
Launched Version: 1.7.10
LWJGL: 2.9.1
OpenGL: Intel
HD Graphics 4000 GL version 4.0.0 - Build 10.18.10.3412, 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)