Résolu Un crash uniquement du coté serveur
-
Bonjour à tout le monde. J’ais voulue réaliser un petit Gui personnalisé qui ne contient pas de slot mais uniquement une image et des labels. Il marche trés bien du coté client mais fais crash lors du chargement coté serveur.
@SideOnly(Side.CLIENT) public class GuiStat extends GuiScreen { int guiWidth= 250; int guiHeight= 250; 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(); this.mc.renderEngine.bindTexture(new ResourceLocation("extaziliamod", "textures/gui/Gui1.png")); drawTexturedModalRect(guix, guiy, 0, 0, guiWidth, guiHeight); fontRendererObj.drawString("A venir ", guix +120, guiy +85, 0x404040 ); fontRendererObj.drawString("A venir ", guix +120, guiy +115, 0x404040 ); fontRendererObj.drawString("A venir ", guix +120, guiy +145, 0x404040 ); super.drawScreen(x, y, ticks); } }
Le soucie vient certainement du faite que le gui mette le jeux en pause du coté client mais j’ais eu beau chercher sur google mais je n’ais pas trouvé pour éviter cela. Si quelqu’un voudrait bien me donner une piste pour résoudre ce soucie.
-
Salut,
Rien à voir avec la pause.
Envoies le rapport de crash + la classe où tu ouvres le gui. -
La classe qui me permet d’ouvrir le gui :
public class Guide1 extends Item { public Guide1() { this.setCreativeTab(CreativeTabs.tabMaterials); this.maxStackSize=1; } public ItemStack onItemRightClick(ItemStack Stack,World world,EntityPlayer player) { if (!world.isRemote){ Minecraft.getMinecraft().displayGuiScreen(new GuiStat()); } return super.onItemRightClick(Stack, world, player); } }
-
Retire le ! devant world.
isRemote signifie “est côté client”. Du coup tu pourras aussi retirer l’annotation SideOnly dans ta classe Gui -
Cela n’empéche pas le crash coté serveur néanmoins merci pour ses informations le crash est :
–-- Minecraft Crash Report ---- // I feel sad now :( Time: 06/03/16 14:15 Description: Exception in server tick loop cpw.mods.fml.common.LoaderException: java.lang.NoClassDefFoundError: net/minecraft/client/gui/GuiScreen at cpw.mods.fml.common.LoadController.transition(LoadController.java:163) at cpw.mods.fml.common.Loader.preinitializeMods(Loader.java:559) at cpw.mods.fml.server.FMLServerHandler.beginServerLoading(FMLServerHandler.java:88) at cpw.mods.fml.common.FMLCommonHandler.onServerStart(FMLCommonHandler.java:314) at net.minecraft.server.dedicated.DedicatedServer.startServer(DedicatedServer.java:120) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:445) at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752) Caused by: java.lang.NoClassDefFoundError: net/minecraft/client/gui/GuiScreen at fr.extazilia.extaziliamod.common.Main.preInit(Main.java:108) 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 cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:532) 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 com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) at com.google.common.eventbus.EventBus.post(EventBus.java:275) at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:212) at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:190) 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 com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) at com.google.common.eventbus.EventBus.post(EventBus.java:275) at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:119) at cpw.mods.fml.common.Loader.preinitializeMods(Loader.java:556) ... 5 more Caused by: java.lang.ClassNotFoundException: net.minecraft.client.gui.GuiScreen at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:191) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 33 more Caused by: java.lang.RuntimeException: Attempted to load class net/minecraft/client/gui/GuiScreen for invalid side SERVER at cpw.mods.fml.common.asm.transformers.SideTransformer.transform(SideTransformer.java:50) at net.minecraft.launchwrapper.LaunchClassLoader.runTransformers(LaunchClassLoader.java:279) at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:176) ... 35 more A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- System Details -- Details: Minecraft Version: 1.7.10 Operating System: Windows 10 (amd64) version 10.0 Java Version: 1.8.0_73, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 947167680 bytes (903 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 UCH mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) UCH FML{7.10.99.99} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.4.1614-1.7.10.jar) UCH Forge{10.13.4.1614} [Minecraft Forge] (forgeSrc-1.7.10-10.13.4.1614-1.7.10.jar) UCE extaziliamod{1.1} [Extazilia Mod] (bin) Profiler Position: N/A (disabled) Is Modded: Definitely; Server brand changed to 'fml,forge' Type: Dedicated Server (map_server.txt)
-
Il faudrait mettre un @SideOnly au dessus onItemRightClick
-
Merci beaucoup mon probléme est résolue grâce à vous robin
-
C’était pourtant pas compliqué de retirer un ! après le if
-
Le if n’était pas seul soucis apparement car j’ais testé en le retirant et cela crashé encore mais en fesais partie alors je te remercie aussi