[1.7.10]Supprimer le bouton ressource pack du menu Options (GuiOptions)
-
aider moi s’il vous plaît !..
-
Eclipse dit quoi comme erreur ?
-
quand je passe ma souris dessus il me dit sa : void is an invalid type for the variable onInitGuiEvent
et sa pour event : Duplicate local variable eventMerci de votre réponse.
-
Envoies toutes la classe dans laquelle tu as mit ce code.
-
Le TickEvent pour ça:
@SubscribeEvent @SideOnly(Side.CLIENT) public void onTick(TickEvent.ClientTickEvent event) { Minecraft mc = FMLClientHandler.instance().getClient(); if(mc.currentScreen != null && mc.currentScreen.getClass().equals(GuiMainMenu.class)) { mc.displayGuiScreen(new GuiCustomMainMenu()); } }n’est pas conseillé. Regarde ce tutoriel: http://www.minecraftforgefrance.fr/showthread.php?tid=2386 (La partie avec l’event GuiOpenEvent)
Sinon, envoies ta classe complète comme a dit robin.
-
c’est ta dire qu’entent tu par le classe parce-que je suis débutant donc j’ai impeux de mal a comprendre le langage de codeur ^^
EDIT : j’ai mis le :
- @SubscribeEvent
- public void onGuiOpen(GuiOpenEvent event) {
- if (event.gui instanceof LeGuiVoulut) event.gui = new VotreGui();
- }
dans Mon GuiMainMenu mais il me demande d’ajouter un argument :
@SubscribeEvent
public void onGuiOpen(GuiOpenEvent event) {
if (event.gui instanceof GuiOptions) event.gui = new GuiCustomOptions(null, null);
}mais sa ne marche toujours pas …

-
package fr.minecraftforgefrance.client.custommenu;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiCustomOptions;
import net.minecraft.client.gui.GuiMainMenu;
import net.minecraft.client.gui.GuiOptions;
import net.minecraftforge.client.event.GuiOpenEvent;
import net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.TickEvent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;@Mod(modid = “custommenu”, name = “Custom Menu”, version = “1.1.0”)
public class ModCustomMenu
{
@EventHandler
public void init(FMLInitializationEvent event)
{
if(event.getSide().isClient())
{
FMLCommonHandler.instance().bus().register(this);
}
}@SubscribeEvent
@SideOnly(Side.CLIENT)
public void onTick(TickEvent.ClientTickEvent event)
{
Minecraft mc = FMLClientHandler.instance().getClient();
if(mc.currentScreen != null && mc.currentScreen.getClass().equals(GuiMainMenu.class))
{
mc.displayGuiScreen(new GuiCustomMainMenu());}
}@SubscribeEvent
public void onGuiOpen(GuiOpenEvent event) {
if (event.gui instanceof GuiOptions) event.gui = new GuiCustomOptions(null, null);
}}
je croix que sais sa que vous voulez non (class) ?
-
Envoies ta classe GuiCustomOption, si c’est bien là qu’eclipse te demande de rajouter des arguments.
-
package net.minecraft.client.gui; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.audio.PositionedSoundRecord; import net.minecraft.client.audio.SoundCategory; import net.minecraft.client.audio.SoundEventAccessorComposite; import net.minecraft.client.audio.SoundHandler; import net.minecraft.client.gui.stream.GuiStreamOptions; import net.minecraft.client.gui.stream.GuiStreamUnavailable; import net.minecraft.client.resources.I18n; import net.minecraft.client.settings.GameSettings; import net.minecraft.client.stream.IStream; @SideOnly(Side.CLIENT) public class GuiCustomOptions extends GuiScreen implements GuiYesNoCallback { private static final GameSettings.Options[] field_146440_f = new GameSettings.Options[] {GameSettings.Options.FOV, GameSettings.Options.DIFFICULTY}; private final GuiScreen field_146441_g; private final GameSettings field_146443_h; protected String field_146442_a = "Options"; private static final String __OBFID = "CL_00000700"; public GuiCustomOptions(GuiScreen p_i1046_1_, GameSettings p_i1046_2_) { this.field_146441_g = p_i1046_1_; this.field_146443_h = p_i1046_2_; } /** * Adds the buttons (and other controls) to the screen in question. */ public void initGui() { int i = 0; this.field_146442_a = I18n.format("options.title", new Object[0]); GameSettings.Options[] aoptions = field_146440_f; int j = aoptions.length; for (int k = 0; k < j; ++k) { GameSettings.Options options = aoptions[k]; if (options.getEnumFloat()) { this.buttonList.add(new GuiOptionSlider(options.returnEnumOrdinal(), this.width / 2 - 155 + i % 2 * 160, this.height / 6 - 12 + 24 * (i >> 1), options)); } else { GuiOptionButton guioptionbutton = new GuiOptionButton(options.returnEnumOrdinal(), this.width / 2 - 155 + i % 2 * 160, this.height / 6 - 12 + 24 * (i >> 1), options, this.field_146443_h.getKeyBinding(options)); if (options == GameSettings.Options.DIFFICULTY && this.mc.theWorld != null && this.mc.theWorld.getWorldInfo().isHardcoreModeEnabled()) { guioptionbutton.enabled = false; guioptionbutton.displayString = I18n.format("options.difficulty", new Object[0]) + ": " + I18n.format("options.difficulty.hardcore", new Object[0]); } this.buttonList.add(guioptionbutton); } ++i; } this.buttonList.add(new GuiButton(8675309, this.width / 2 + 5, this.height / 6 + 48 - 6, 150, 20, "Super Secret Settings…") { private static final String __OBFID = "CL_00000701"; public void func_146113_a(SoundHandler p_146113_1_) { SoundEventAccessorComposite soundeventaccessorcomposite = p_146113_1_.getRandomSoundFromCategories(new SoundCategory[] {SoundCategory.ANIMALS, SoundCategory.BLOCKS, SoundCategory.MOBS, SoundCategory.PLAYERS, SoundCategory.WEATHER}); if (soundeventaccessorcomposite != null) { p_146113_1_.playSound(PositionedSoundRecord.func_147674_a(soundeventaccessorcomposite.getSoundEventLocation(), 0.5F)); } } }); this.buttonList.add(new GuiButton(106, this.width / 2 - 155, this.height / 6 + 72 - 6, 150, 20, I18n.format("options.sounds", new Object[0]))); this.buttonList.add(new GuiButton(107, this.width / 2 + 5, this.height / 6 + 72 - 6, 150, 20, I18n.format("options.stream", new Object[0]))); this.buttonList.add(new GuiButton(101, this.width / 2 - 155, this.height / 6 + 96 - 6, 150, 20, I18n.format("options.video", new Object[0]))); this.buttonList.add(new GuiButton(100, this.width / 2 + 5, this.height / 6 + 96 - 6, 150, 20, I18n.format("options.controls", new Object[0]))); this.buttonList.add(new GuiButton(102, this.width / 2 - 155, this.height / 6 + 120 - 6, 150, 20, I18n.format("options.language", new Object[0]))); this.buttonList.add(new GuiButton(103, this.width / 2 + 5, this.height / 6 + 120 - 6, 150, 20, I18n.format("options.multiplayer.title", new Object[0]))); this.buttonList.add(new GuiButton(105, this.width / 2 - 155, this.height / 6 + 144 - 6, 150, 20, I18n.format("LeBoutonASuprimerRessourcePack", new Object[0]))); this.buttonList.add(new GuiButton(104, this.width / 2 + 5, this.height / 6 + 144 - 6, 150, 20, I18n.format("options.snooper.view", new Object[0]))); this.buttonList.add(new GuiButton(200, this.width / 2 - 100, this.height / 6 + 168, I18n.format("gui.done", new Object[0]))); } protected void actionPerformed(GuiButton p_146284_1_) { if (p_146284_1_.enabled) { if (p_146284_1_.id < 100 && p_146284_1_ instanceof GuiOptionButton) { this.field_146443_h.setOptionValue(((GuiOptionButton)p_146284_1_).returnEnumOptions(), 1); p_146284_1_.displayString = this.field_146443_h.getKeyBinding(GameSettings.Options.getEnumOptions(p_146284_1_.id)); } if (p_146284_1_.id == 8675309) { this.mc.entityRenderer.activateNextShader(); } if (p_146284_1_.id == 101) { this.mc.gameSettings.saveOptions(); this.mc.displayGuiScreen(new GuiVideoSettings(this, this.field_146443_h)); } if (p_146284_1_.id == 100) { this.mc.gameSettings.saveOptions(); this.mc.displayGuiScreen(new GuiControls(this, this.field_146443_h)); } if (p_146284_1_.id == 102) { this.mc.gameSettings.saveOptions(); this.mc.displayGuiScreen(new GuiLanguage(this, this.field_146443_h, this.mc.getLanguageManager())); } if (p_146284_1_.id == 103) { this.mc.gameSettings.saveOptions(); this.mc.displayGuiScreen(new ScreenChatOptions(this, this.field_146443_h)); } if (p_146284_1_.id == 104) { this.mc.gameSettings.saveOptions(); this.mc.displayGuiScreen(new GuiSnooper(this, this.field_146443_h)); } if (p_146284_1_.id == 200) { this.mc.gameSettings.saveOptions(); this.mc.displayGuiScreen(this.field_146441_g); } if (p_146284_1_.id == 105) { this.mc.gameSettings.saveOptions(); this.mc.displayGuiScreen(new GuiScreenResourcePacks(this)); } if (p_146284_1_.id == 106) { this.mc.gameSettings.saveOptions(); this.mc.displayGuiScreen(new GuiScreenOptionsSounds(this, this.field_146443_h)); } if (p_146284_1_.id == 107) { this.mc.gameSettings.saveOptions(); IStream istream = this.mc.func_152346_Z(); if (istream.func_152936_l() && istream.func_152928_D()) { this.mc.displayGuiScreen(new GuiStreamOptions(this, this.field_146443_h)); } else { GuiStreamUnavailable.func_152321_a(this); } } } } /** * Draws the screen and all the components in it. */ public void drawScreen(int p_73863_1_, int p_73863_2_, float p_73863_3_) { this.drawDefaultBackground(); this.drawCenteredString(this.fontRendererObj, this.field_146442_a, this.width / 2, 15, 16777215); super.drawScreen(p_73863_1_, p_73863_2_, p_73863_3_); } } -
new GuiCustomOptions(null, null); ––>>
new GuiCustomOptions(Minecraft.getMinecraft().currentScreen, Minecraft.getMinecraft().gameSettings /** ou un truc dans me genre */); -
J’ai mis c’ete ligne de code ––>
[font=Ubuntu, sans-serifnew GuiCustomOptions(Minecraft.getMinecraft().currentScreen, Minecraft.getMinecraft().gameSettings /** ou un truc dans me genre */);]
[font=Ubuntu, sans-serifque tu ma proposer mais le bouton ressource pas est toujours la … :/]
-
GuiOpenEvent n’est pas un event fml mais un event forge, normal que ça marche pas, enregistre ton event avec forge

-
ha ok d’accords merci mais , comment je fait pour le maître en fml …

-
FMLCommonHandler.instance().bus().register(tonObjet)
PS : “mettre”, je sais je suis chiant.
-
se que tu vien de me de me donner ne m’aide pas beaucoup , Ou le placer ?
si j’ai donner ma classe c’est pour que vous me donniez un exemple !([font=Ubuntu, sans-serifPS : “mettre”, je sais je suis chiant.)]
PS : dsl de réclamer de l’aide sur un “FORUM” ou devrais se trouver un communautés qui soutienne les autres qui les aider , mais bon je voie que la communautés et très critique sur se forum … -
Tu dois le mettre à la place de l’enregistrement avec forge.
Si je le dis dans un PS, c’est juste que j’aime bien l’orthographe. En revanche je ne pense pas que tu puisses dire que la communauté n’est pas là pour t’aider, les seules choses qui nous énerve sur le forum c’est le fait que les membres ne cherchent pas un minimum comme marqué dans les règles de la section. J’ai relu les postes précédents pour voir le problème en entier, d’après ce que j’ai vu, tu as eu plusieurs liens proposés avec dans chacun la réponse à ton problème.
-
“Tu dois le mettre à la place de l’enregistrement avec forge.”
Oui je veux bien mais c’est ou ? (montre moi avec ma classe custommainmenu que j’ai donner ), j’en suit a mes début donc sais un peux flou pour moi !
ps: “j’aime bien l’orthographe” merci sais gentil de critiquer , surtout quand on est “dyslexique” & un problème de “Dysorthographie” , bref je ne vais pas m’exprimer plus sur ma vie, je suis pas la pour me cosser un problème .et aussi j’ai chercher ne t’inquiète pas pas mais si je demande de l’aider personnaliser c’est parce-que j’ai chercher mais rien de rien ne marche … j’ai été sur tout les sujet du site parlant de supprimer le bouton ressource pack,mais sa ne marche pas , sinon je n’aurais j’ai crée se sujet …
-
Justement, cest pas avec fml quil faut l’enregistrer,
dans ta méthode initialisation rajoute : MinecraftForge.EVENT_BUS.register(this); -
@SubscribeEvent @SideOnly(Side.CLIENT) public void onGuiOpen(GuiOpenEvent event) { if (event.gui instanceof GuiOptions) event.gui = new GuiCustomOptions(Minecraft.getMinecraft().currentScreen, Minecraft.getMinecraft().gameSettings); MinecraftForge.EVENT_BUS.register(this);Comme sa ?
-
Il faut mettre la ligne dans le ClientProxy normalement ou alors dans un bloc de code exécuté seulement côté client pour enregistrer l’handler