Crash Serveur



  • Bonsoir,

    Je rencontre plusieurs crash au lancement de mon serveur avec mon mod:

    Les voici:

    
    –-- Minecraft Crash Report ----
    
    WARNING: coremods are present:
      SpongeCoremod (spongeforge-1.8-1577-3.0.0-BETA-1000 (1).jar)
    Contact their authors BEFORE contacting forge
    
    // Ouch. That hurt :(
    
    Time: 12/10/16 16:30
    Description: Exception in server tick loop
    
    net.minecraftforge.fml.common.LoaderException: java.lang.NoClassDefFoundError: net/minecraft/client/entity/EntityPlayerSP
    at net.minecraftforge.fml.common.LoadController.transition(LoadController.java:163)
    at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:553)
    at net.minecraftforge.fml.server.FMLServerHandler.beginServerLoading(FMLServerHandler.java:88)
    at net.minecraftforge.fml.common.FMLCommonHandler.onServerStart(FMLCommonHandler.java:355)
    at net.minecraft.server.dedicated.DedicatedServer.func_71197_b(DedicatedServer.java:117)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:438)
    at java.lang.Thread.run(Thread.java:745)
    Caused by: java.lang.NoClassDefFoundError: net/minecraft/client/entity/EntityPlayerSP
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2671)
    at java.lang.Class.getConstructor0(Class.java:3075)
    at java.lang.Class.newInstance(Class.java:412)
    at net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper.instantiate(SimpleNetworkWrapper.java:113)
    at net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper.registerMessage(SimpleNetworkWrapper.java:106)
    at com.CSC.net.Main.preinit(Main.java:53)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:553)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    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 net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:212)
    at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:190)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    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 net.minecraftforge.fml.common.LoadController.onPost(LoadController.java:53)
    at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:119)
    at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:550)
    ... 5 more
    Caused by: java.lang.ClassNotFoundException: net.minecraft.client.entity.EntityPlayerSP
    at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:191)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 40 more
    Caused by: net.minecraftforge.fml.common.asm.ASMTransformerWrapper$TransformerException: Exception in class transformer net.minecraftforge.fml.common.asm.transformers.SideTransformer@1c3c1e1 from coremod FMLCorePlugin
    at net.minecraftforge.fml.common.asm.ASMTransformerWrapper$TransformerWrapper.transform(ASMTransformerWrapper.java:234)
    at net.minecraft.launchwrapper.LaunchClassLoader.runTransformers(LaunchClassLoader.java:279)
    at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:176)
    ... 42 more
    Caused by: java.lang.RuntimeException: Attempted to load class cio for invalid side SERVER
    at net.minecraftforge.fml.common.asm.transformers.SideTransformer.transform(SideTransformer.java:49)
    at net.minecraftforge.fml.common.asm.ASMTransformerWrapper$TransformerWrapper.transform(ASMTransformerWrapper.java:230)
    ... 44 more
    
    A detailed walkthrough of the error, its code path and all known details is as follows:
    ---------------------------------------------------------------------------------------
    
    -- System Details --
    Details:
    Minecraft Version: 1.8
    Operating System: Windows 7 (x86) version 6.1
    Java Version: 1.8.0_45, Oracle Corporation
    Java VM Version: Java HotSpot(TM) Client VM (mixed mode), Oracle Corporation
    Memory: 114658872 bytes (109 MB) / 215465984 bytes (205 MB) up to 1037959168 bytes (989 MB)
    JVM Flags: 1 total; -Xmx1024M
    IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
    FML: MCP v9.10 FML v8.0.99.99 Minecraft Forge 11.14.4.1563 6 mods loaded, 6 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{8.0.99.99} [Forge Mod Loader] (forge.jar) 
    UCH Forge{11.14.4.1563} [Minecraft Forge] (forge.jar) 
    UCH sponge{1.8-1577-3.0.0-BETA-1000} [SpongeForge] (spongeforge-1.8-1577-3.0.0-BETA-1000 (1).jar) 
    UCH me.florian{0.0.1} [CSCPlugin] (cscplugin-0.0.1-SNAPSHOT.jar) 
    UCE csc{1.0} [Cite Sous Controle] (modid-1.0.jar) 
    Loaded coremods (and transformers): 
    SpongeCoremod (spongeforge-1.8-1577-3.0.0-BETA-1000 (1).jar)
      org.spongepowered.common.launch.transformer.SpongeSuperclassTransformer
    Profiler Position: N/A (disabled)
    Is Modded: Definitely; Server brand changed to 'fml,forge,SpongeForge'
    Type: Dedicated Server (map_server.txt)
    
    

    Ligne 53 de la main class:

            network.registerMessage(PacketSang.Handler.class, PacketSang.class, 0, Side.CLIENT);
    

    PacketSang:

    
    package com.CSC.net.packet;
    
    import io.netty.buffer.ByteBuf;
    import net.minecraft.client.Minecraft;
    import net.minecraft.entity.player.EntityPlayer;
    import net.minecraft.util.EnumParticleTypes;
    import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
    import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
    import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
    
    public class PacketSang implements IMessage{
    
    public PacketSang()
    {
    
    }
    
    @Override
    public void fromBytes(ByteBuf buf) 
    {
    
    }
    
    @Override
    public void toBytes(ByteBuf buf) 
    {
    
    }
    
    public static class Handler implements IMessageHandler <packetsang, imessage="">{
       public IMessage onMessage(PacketSang message, MessageContext ctx) 
       {
        EntityPlayer player = Minecraft.getMinecraft().thePlayer;
        player.worldObj.spawnParticle(EnumParticleTypes.REDSTONE, player.posX + 0.5D, player.posY + 1.0D, player.posZ + 0.5D, 0.0D, 0.0D, 0.0D, new int[0]);
        player.worldObj.spawnParticle(EnumParticleTypes.REDSTONE, player.posX, player.posY, player.posZ + 0.5D, 0.0D, 0.0D, 0.0D, new int[0]);
        player.worldObj.spawnParticle(EnumParticleTypes.REDSTONE, player.posX + 1.0D, player.posY + 1.0D, player.posZ + 1.0D, 0.0D, 0.0D, 0.0D, new int[0]);
        player.worldObj.spawnParticle(EnumParticleTypes.REDSTONE, player.posX + 0.2D, player.posY + 1.1D, player.posZ + 0.5D, 0.0D, 0.0D, 0.0D, new int[0]);
        player.worldObj.spawnParticle(EnumParticleTypes.REDSTONE, player.posX + 0.1D, player.posY + 1.5D, player.posZ + 0.5D, 0.0D, 0.0D, 0.0D, new int[0]);
        player.worldObj.spawnParticle(EnumParticleTypes.REDSTONE, player.posX + 0.3D, player.posY + 1.2D, player.posZ + 0.5D, 0.0D, 0.0D, 0.0D, new int[0]);
        player.worldObj.spawnParticle(EnumParticleTypes.REDSTONE, player.posX + 0.4D, player.posY + 1.8D, player.posZ + 0.5D, 0.0D, 0.0D, 0.0D, new int[0]);
        player.worldObj.spawnParticle(EnumParticleTypes.REDSTONE, player.posX + 0.6D, player.posY + 1.6D, player.posZ + 0.5D, 0.0D, 0.0D, 0.0D, new int[0]);
        player.worldObj.spawnParticle(EnumParticleTypes.REDSTONE, player.posX + 0.5D, player.posY + 1.0D, player.posZ + 0.5D, 0.0D, 0.0D, 0.0D, new int[0]);
        player.worldObj.spawnParticle(EnumParticleTypes.REDSTONE, player.posX + 0.5D, player.posY + 1.0D, player.posZ + 0.5D, 0.0D, 0.0D, 0.0D, new int[0]);
        player.worldObj.spawnParticle(EnumParticleTypes.REDSTONE, player.posX + 0.5D, player.posY + 1.0D, player.posZ + 0.5D, 0.0D, 0.0D, 0.0D, new int[0]);
    
        return null;
    
       }
    }
    
    }
    
    

    Event:

    
    @SideOnly(Side.CLIENT)
    @SubscribeEvent
    public void onHit(LivingHurtEvent event)
    {
    if(event.entityLiving instanceof EntityPlayer)
    {
    System.out.println("eventhurt");
    Main.network.sendTo(new PacketSang(), (EntityPlayerMP)event.entityLiving);
    }
    }
    
    

    Et l'autre crash:

    
    –-- Minecraft Crash Report ----
    
    WARNING: coremods are present:
      SpongeCoremod (spongeforge-1.8-1577-3.0.0-BETA-1000 (1).jar)
    Contact their authors BEFORE contacting forge
    
    // This is a token for 1 free hug. Redeem at your nearest Mojangsta: [~~HUG~~]
    
    Time: 12/10/16 16:25
    Description: Exception in server tick loop
    
    net.minecraftforge.fml.common.LoaderException: java.lang.NoClassDefFoundError: net/minecraft/client/gui/GuiScreen
    at net.minecraftforge.fml.common.LoadController.transition(LoadController.java:163)
    at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:553)
    at net.minecraftforge.fml.server.FMLServerHandler.beginServerLoading(FMLServerHandler.java:88)
    at net.minecraftforge.fml.common.FMLCommonHandler.onServerStart(FMLCommonHandler.java:355)
    at net.minecraft.server.dedicated.DedicatedServer.func_71197_b(DedicatedServer.java:117)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:438)
    at java.lang.Thread.run(Thread.java:745)
    Caused by: java.lang.NoClassDefFoundError: net/minecraft/client/gui/GuiScreen
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2671)
    at java.lang.Class.getConstructor0(Class.java:3075)
    at java.lang.Class.newInstance(Class.java:412)
    at net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper.instantiate(SimpleNetworkWrapper.java:113)
    at net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper.registerMessage(SimpleNetworkWrapper.java:106)
    at com.CSC.net.Main.preinit(Main.java:54)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:553)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    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 net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:212)
    at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:190)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    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 net.minecraftforge.fml.common.LoadController.onPost(LoadController.java:53)
    at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:119)
    at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:550)
    … 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(ClassLoader.java:424)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 40 more
    Caused by: net.minecraftforge.fml.common.asm.ASMTransformerWrapper$TransformerException: Exception in class transformer net.minecraftforge.fml.common.asm.transformers.SideTransformer@1c3c1e1 from coremod FMLCorePlugin
    at net.minecraftforge.fml.common.asm.ASMTransformerWrapper$TransformerWrapper.transform(ASMTransformerWrapper.java:234)
    at net.minecraft.launchwrapper.LaunchClassLoader.runTransformers(LaunchClassLoader.java:279)
    at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:176)
    ... 42 more
    Caused by: java.lang.RuntimeException: Attempted to load class bxf for invalid side SERVER
    at net.minecraftforge.fml.common.asm.transformers.SideTransformer.transform(SideTransformer.java:49)
    at net.minecraftforge.fml.common.asm.ASMTransformerWrapper$TransformerWrapper.transform(ASMTransformerWrapper.java:230)
    ... 44 more
    
    A detailed walkthrough of the error, its code path and all known details is as follows:
    ---------------------------------------------------------------------------------------
    
    -- System Details --
    Details:
    Minecraft Version: 1.8
    Operating System: Windows 7 (x86) version 6.1
    Java Version: 1.8.0_45, Oracle Corporation
    Java VM Version: Java HotSpot(TM) Client VM (mixed mode), Oracle Corporation
    Memory: 114824448 bytes (109 MB) / 215465984 bytes (205 MB) up to 1037959168 bytes (989 MB)
    JVM Flags: 1 total; -Xmx1024M
    IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
    FML: MCP v9.10 FML v8.0.99.99 Minecraft Forge 11.14.4.1563 6 mods loaded, 6 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{8.0.99.99} [Forge Mod Loader] (forge.jar) 
    UCH Forge{11.14.4.1563} [Minecraft Forge] (forge.jar) 
    UCH sponge{1.8-1577-3.0.0-BETA-1000} [SpongeForge] (spongeforge-1.8-1577-3.0.0-BETA-1000 (1).jar) 
    UCH me.florian{0.0.1} [CSCPlugin] (cscplugin-0.0.1-SNAPSHOT.jar) 
    UCE csc{1.0} [Cite Sous Controle] (modid-1.0.jar) 
    Loaded coremods (and transformers): 
    SpongeCoremod (spongeforge-1.8-1577-3.0.0-BETA-1000 (1).jar)
      org.spongepowered.common.launch.transformer.SpongeSuperclassTransformer
    Profiler Position: N/A (disabled)
    Is Modded: Definitely; Server brand changed to 'fml,forge,SpongeForge'
    Type: Dedicated Server (map_server.txt)
    
    

    Ligne 54 de la main class:

    network.registerMessage(PacketGui.Handler.class, PacketGui.class, 1, Side.SERVER);
    

    PacketGui:

    
    package com.CSC.net.packet;
    
    import io.netty.buffer.ByteBuf;
    import net.minecraft.client.Minecraft;
    import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
    import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
    import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
    
    import com.CSC.net.GUI.Prison;
    import com.CSC.net.GUI.menuF4;
    import com.CSC.net.item.batonP;
    
    public class PacketGui implements IMessage{
    
    private int i;
    
    public PacketGui()
    {
    
    }
    
    public PacketGui(Integer integer)
    {
    this.i = integer;
    }
    
    @Override
    public void fromBytes(ByteBuf buf) {
    this.i = buf.readInt();
    }
    
    @Override
    public void toBytes(ByteBuf buf) {
    buf.writeInt(i);
    }
    
    public static class Handler implements IMessageHandler <packetgui, imessage="">{
    @Override
       public IMessage onMessage(PacketGui message, MessageContext ctx) {
    
    switch(message.i) {
     case 0:
     Minecraft.getMinecraft().displayGuiScreen(new menuF4());
     break;
     case 1:
     Minecraft.getMinecraft().displayGuiScreen(new Prison());
     break;
     default:
     break;
    }
        return null;
    
       }
    }
    
    }
    
    

    Gui prison:

    
    package com.CSC.net.GUI;
    
    import java.io.IOException;
    import java.util.Date;
    
    import net.minecraft.client.gui.GuiButton;
    import net.minecraft.client.gui.GuiScreen;
    import net.minecraft.client.gui.GuiTextField;
    import net.minecraft.util.ChatComponentText;
    import net.minecraft.util.EnumChatFormatting;
    import net.minecraft.util.ResourceLocation;
    import net.minecraftforge.fml.relauncher.Side;
    import net.minecraftforge.fml.relauncher.SideOnly;
    
    import org.lwjgl.input.Keyboard;
    
    import com.CSC.net.Main;
    import com.CSC.net.item.batonP;
    
    @SideOnly(Side.CLIENT)
    public class Prison extends GuiScreen{
    
    private ResourceLocation ressource = new ResourceLocation(Main.MODID + ":textures/gui/PrisonGui.png");
    
    private int valider;
    
    private int textid;
    
    public static GuiTextField text;
    
    public Prison() {
    
    }
    
    @Override
    public void initGui() {
    
    valider = 0;
    
    textid = 1;
    
    text = new GuiTextField(textid, fontRendererObj, width / 2 - 32, 130, 64, 20);
    
    text.setFocused(true);
    
    Keyboard.enableRepeatEvents(true);
    
    this.buttonList.add(new GuiButton(valider, width / 2 - 123, 230, 40, 20, "Valider"));
    
    super.initGui();
    }
    
    @Override
    protected void keyTyped(char typedChar, int keyCode) throws IOException {
    
    text.textboxKeyTyped(typedChar, keyCode);
    
    super.keyTyped(typedChar, keyCode);
    }
    
    @Override
    protected void actionPerformed(GuiButton button) throws IOException {
    
    switch(button.id) {
    case 0:
    if(text.getText().equals("1"))
    {
    batonP.map.put(batonP.base, setDate(300));
    System.out.println(batonP.base);
    mc.thePlayer.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Vous avez emprisonné " + batonP.base.getDisplayName() + " pour 1 cycle"));
    this.mc.thePlayer.closeScreen();
    }
    else if(text.getText().equals("2"))
    {
    batonP.map.put(batonP.base, setDate(600));
    System.out.println("2");
    mc.thePlayer.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Vous avez emprisonné " + batonP.base.getDisplayName() + " pour 2 cycles"));
    this.mc.thePlayer.closeScreen();
    }
    else if(text.getText().equals("3"))
    {
    batonP.map.put(batonP.base, setDate(900));
    System.out.println("3");
    mc.thePlayer.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Vous avez emprisonné " + batonP.base.getDisplayName() + " pour 3 cycles"));
    this.mc.thePlayer.closeScreen();
    }
    else if(text.getText().equals("4"))
    {
    batonP.map.put(batonP.base, setDate(1200));
    System.out.println("4");
    mc.thePlayer.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Vous avez emprisonné " + batonP.base.getDisplayName() + " pour 4 cycles"));
    this.mc.thePlayer.closeScreen();
    }
    else if(text.getText().equals("5"))
    {
    batonP.map.put(batonP.base, setDate(1500));
    System.out.println("5");
    mc.thePlayer.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Vous avez emprisonné " + batonP.base.getDisplayName() + " pour 5 cycles"));
    this.mc.thePlayer.closeScreen();
    }
    else{
    mc.thePlayer.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.RED + "Erreur: Veuillez saisir un cycle entre 1 et 5"));
    }
    break;
    case 1:
    break;
    default:
    break;
    }
    
    super.actionPerformed(button);
    }
    
    @Override
    public void updateScreen() {
    super.updateScreen();
    }
    
    public void drawScreen(int mouseX, int mouseY, float partialTick) {
    
    mc.getTextureManager().bindTexture(ressource);
    
    text.drawTextBox();
    
    this.drawTexturedModalRect(this.width / 2 - 135, this.height / 2 - 125, 0, 0, 256, 250);
    
    super.drawScreen(mouseX, mouseY, partialTick);
        }
    
    @Override
    public void onGuiClosed() {
    
    }
    
    private static Date setDate(int delay)
    {
    Date date = new Date();
    date.setSeconds(date.getSeconds() + delay);
    return date;
    }
    
    }
    
    

    Gui menuF4:

    
    package com.CSC.net.GUI;
    
    import java.awt.Desktop;
    import java.io.IOException;
    import java.net.URI;
    
    import com.CSC.net.Main;
    
    import net.minecraft.client.gui.GuiButton;
    import net.minecraft.client.gui.GuiScreen;
    import net.minecraft.util.ResourceLocation;
    import net.minecraftforge.fml.client.FMLClientHandler;
    
    public class menuF4 extends GuiScreen{
    
    private ResourceLocation ressource = new ResourceLocation("csc:textures/gui/menu_f4.png");
    
    private int closebutton;
    
    private int jobs;
    
    private int regles;
    
    private int commandes;
    
    private int achats;
    
    private int autres;
    
    public menuF4() {
    
    }
    
    @Override
    public void initGui() {
    
    closebutton = 0;
    
    jobs = 1;
    
    regles = 2;
    
    commandes = 3;
    
    achats = 4;
    
    autres = 5;
    
    this.buttonList.add(new BoutonCustom(closebutton, width - 148, 2, 40, 20, "§f"));
    
    this.buttonList.add(new BoutonCustom(jobs, width / 2 - 115, height / 2 - 40, 40, 20, "§fJobs"));
    
    this.buttonList.add(new BoutonCustom(regles, width / 2 - 115, height / 2 + 6, 40, 20, "§fRègles"));
    
    this.buttonList.add(new BoutonCustom(commandes, width / 2 - 115, height / 2 + 53, 40, 20, "§fCommandes"));
    
    this.buttonList.add(new BoutonCustom(achats, width / 2 - 115, height / 2 + 88, 40, 20, "§fAchats"));
    
    this.buttonList.add(new BoutonCustom(autres, width / 2 - 115, height / 2 + 108, 40, 20, "§fAutres"));
    
    super.initGui();
    }
    
    @Override
    protected void keyTyped(char typedChar, int keyCode) throws IOException {
    super.keyTyped(typedChar, keyCode);
    }
    
    @Override
    protected void actionPerformed(GuiButton button) throws IOException {
    
    switch(button.id) {
    case 0:
    this.mc.thePlayer.closeScreen();
    break;
    case 1:
    break;
    default:
    break;
    }
    
    super.actionPerformed(button);
    }
    
    @Override
    public void updateScreen() {
    super.updateScreen();
    }
    
    public void drawScreen(int mouseX, int mouseY, float partialTick) {
    
    mc.getTextureManager().bindTexture(ressource);
    
    this.drawTexturedModalRect(this.width / 2 - 135, this.height / 2 - 126, 0, 0, 255, 253);
    this.drawString(this.fontRendererObj, "§c" + mc.thePlayer.getDisplayNameString(), this.width / 2 - 90, this.height / 2 - 110, 0);
    super.drawScreen(mouseX, mouseY, partialTick);
    
    mc.getTextureManager().bindTexture(mc.thePlayer.getLocationSkin());
    this.drawTexturedModalRect(this.width / 2 - 128, this.height / 2 - 121, 32, 30, 32, 34);
        }
    
    @Override
    public void onGuiClosed() {
    
    }
    
    }
    
    

    Voilà merci d'avance !</packetgui,></packetsang,>


  • Moddeurs confirmés Rédacteurs Administrateurs

    Salut,
    Dans les deux cas ajoutes un @SideOnly(Side.CLIENT) au dessus de la fonction onMessage de l'handler de tes paquets.



  • @'robin4002':

    Salut,
    Dans les deux cas ajoutes un @SideOnly(Side.CLIENT) au dessus de la fonction onMessage de l'handler de tes paquets.

    Ah ouaip merci 😄

    par contre j'ai un problème quand j'ouvre mon menuf4 quand le serveur est lancer j'ai un crash dans la console de mon serveur et ça me kick en disant: A fatal error has occured, this connection is terminated .

    Le serveur m'a pas crée un crash-report du coup j'ai du screen la console …

    Donc bon je sais c'est pas pratique a lire mais je sais pas comment faire autrement .

    Screen:


  • Moddeurs confirmés Rédacteurs Administrateurs

    network.registerMessage(PacketGui.Handler.class, PacketGui.class, 1, Side.SERVER);
    ça devrait pas être client ici ?

    Ton paquet PacketGui est envoyé au client ou au serveur ?



  • @'robin4002':

    network.registerMessage(PacketGui.Handler.class, PacketGui.class, 1, Side.SERVER);
    ça devrait pas être client ici ?

    Ton paquet PacketGui est envoyé au client ou au serveur ?

       private void keyTestTyped()
       {
           System.out.println("");
           Main.network.sendToServer(new PacketGui(0));
    }
    

    Il est envoyer côté serveur, il faut l'envoyer côté client ?


  • Moddeurs confirmés Rédacteurs Administrateurs

    Pourquoi tu envoie au serveur un paquet qui à pour action Minecraft.getMinecraft().displayGuiScreen(new menuF4());
    ???
    Minecraft.getMinecraft() n'existe pas côté serveur.

    Si tu veux ouvrir un gui lorsque tu appuies sur une touche, tu n'as même pas besoin de paquet.


Log in to reply