Résolu Empecher l'ouverture de l'inventaire du joueur
-
Salut, je cherches à empecher d’acceder à l’inventaire, mon code qui me fait crasher:
@SubscribeEvent public void GuiScreenEvent(GuiScreenEvent event){ if(event.gui instanceof GuiInventory){ event.setCanceled(true); } }
[23:00:21] [Server thread/INFO]: Saving chunks for level ‘Nouveau monde’/The End
[23:00:46] [Server thread/INFO]: Player312 vient d’obtenir le succès [Faire l’inventaire]
[23:00:46] [Client thread/ERROR] [FML]: Exception caught during firing event net.minecraftforge.client.event.GuiScreenEvent$InitGuiEvent$Post@97c86d2:
java.lang.IllegalArgumentException: Attempted to cancel a uncancelable event
at cpw.mods.fml.common.eventhandler.Event.setCanceled(Event.java:111) ~[Event.class:?]
at com.sosoh.minefusinventory.common.MinefusEventHandler.GuiScreenEvent(MinefusEventHandler.java:22) ~[MinefusEventHandler.class:?]
at cpw.mods.fml.common.eventhandler.ASMEventHandler_9_MinefusEventHandler_GuiScreenEvent_GuiScreenEvent.invoke(.dynamic) ~[?:?]
at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:54) ~[ASMEventHandler.class:?]
at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:138) [EventBus.class:?]
at net.minecraft.client.gui.GuiScreen.setWorldAndResolution(GuiScreen.java:296) [GuiScreen.class:?]
at net.minecraft.client.Minecraft.displayGuiScreen(Minecraft.java:854) [Minecraft.class:?]
at net.minecraft.client.Minecraft.runTick(Minecraft.java:1975) [Minecraft.class:?]
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1028) [Minecraft.class:?]
at net.minecraft.client.Minecraft.run(Minecraft.java:951) [Minecraft.class:?]
at net.minecraft.client.main.Main.main(Main.java:164) [Main.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_71]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_71]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_71]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_71]
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.11.jar:?]
at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.11.jar:?]
at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:85) [start/:?]
at GradleStart.main(GradleStart.java:45) [start/:?] -
je pense que ce n’est pas le bon event
-
J’ai mis: [size=mediumGuiOpenEvent a la place cela marche ^^ Je suis con ^^ Merci]
-
De rien