Crash lors de l'ouverture de mon inventaire custom



  • Voici mon crash report lorsque j'essaye d'ouvrir mon inventaire tout fonctionné avant je ne comprend pas d'ou vient le problème:

    [16:27:52] [Server thread/ERROR] [FML]: There was a critical exception handling a packet on channel Docraft
    io.netty.handler.codec.DecoderException: java.lang.NullPointerException
    at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:99) ~[MessageToMessageDecoder.class:?]
    at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) ~[MessageToMessageCodec.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) ~[DefaultChannelHandlerContext.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) ~[DefaultChannelHandlerContext.class:?]
    at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785) ~[DefaultChannelPipeline.class:?]
    at io.netty.channel.embedded.EmbeddedChannel.writeInbound(EmbeddedChannel.java:169) ~[EmbeddedChannel.class:?]
    at cpw.mods.fml.common.network.internal.FMLProxyPacket.processPacket(FMLProxyPacket.java:86) [FMLProxyPacket.class:?]
    at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:241) [NetworkManager.class:?]
    at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182) [NetworkSystem.class:?]
    at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:726) [MinecraftServer.class:?]
    at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614) [MinecraftServer.class:?]
    at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) [IntegratedServer.class:?]
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485) [MinecraftServer.class:?]
    at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752) [MinecraftServer$2.class:?]
    Caused by: java.lang.NullPointerException
    at blocks.tablesdecrafttest.GuiHandlerTuto.getServerGuiElement(GuiHandlerTuto.java:27) ~[GuiHandlerTuto.class:?]
    at cpw.mods.fml.common.network.NetworkRegistry.getRemoteGuiContainer(NetworkRegistry.java:241) ~[NetworkRegistry.class:?]
    at cpw.mods.fml.common.network.internal.FMLNetworkHandler.openGui(FMLNetworkHandler.java:75) ~[FMLNetworkHandler.class:?]
    at net.minecraft.entity.player.EntityPlayer.openGui(EntityPlayer.java:2501) ~[EntityPlayer.class:?]
    at inventaire.OpenGuiPacket.handleServerSide(OpenGuiPacket.java:34) ~[OpenGuiPacket.class:?]
    at inventaire.PacketPipeline.decode(PacketPipeline.java:91) ~[PacketPipeline.class:?]
    at inventaire.PacketPipeline.decode(PacketPipeline.java:1) ~[PacketPipeline.class:?]
    at io.netty.handler.codec.MessageToMessageCodec$2.decode(MessageToMessageCodec.java:81) ~[MessageToMessageCodec$2.class:?]
    at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:89) ~[MessageToMessageDecoder.class:?]
    … 13 more
    

    Merci d'avance



  • at blocks.tablesdecrafttest.GuiHandlerTuto.getServerGuiElement(GuiHandlerTuto.java:27) ~[GuiHandlerTuto.class:?]
    

    Pourrait-on avoir la classe concernée ?



  • Oui voici ma classe

    package blocks.tablesdecrafttest;
    
    import blocks.tablesdecraft.Containertabledecraftbucheron;
    import blocks.tablesdecraft.Guitabledecraftbucheron;
    import cpw.mods.fml.common.network.IGuiHandler;
    import inventaire.DocraftContainerPlayer;
    import inventaire.GUIDocraftInventoryPlayer;
    import joueur.ExtendedEntityPropCaracteristique;
    import mods.TutoMod;
    import net.minecraft.entity.player.EntityPlayer;
    import net.minecraft.tileentity.TileEntity;
    import net.minecraft.world.World;
    
    public class GuiHandlerTuto
    implements IGuiHandler
    {
    public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
    {
    TileEntity tile = world.getTileEntity(x, y, z);
    if ((tile instanceof TileEntityMachineTuto)) {
    return new ContainerMachineTuto((TileEntityMachineTuto)tile, player.inventory);
    }
    if (ID == 1) {
    return (ID == 1) && (world.getBlock(x, y, z) == TutoMod.tabledecraftbucheron) ? new Containertabledecraftbucheron(player.inventory, world, x, y, z) : null;
    }
    if (ID == TutoMod.GUI_Docraft_INV) {
    return new DocraftContainerPlayer(player, player.inventory, ExtendedEntityPropCaracteristique.get(player).inventory);
    }
    return null;
    }
    
    public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
    {
    TileEntity tile = world.getTileEntity(x, y, z);
    if ((tile instanceof TileEntityMachineTuto)) {
    return new GuiMachineTuto((TileEntityMachineTuto)tile, player.inventory);
    }
    if (ID == 1) {
    return (ID == 1) && (world.getBlock(x, y, z) == TutoMod.tabledecraftbucheron) ? new Guitabledecraftbucheron(player.inventory, world, x, y, z) : null;
    }
    if (ID == TutoMod.GUI_Docraft_INV) {
    return new GUIDocraftInventoryPlayer(player, player.inventory, ExtendedEntityPropCaracteristique.get(player).inventory);
    }
    return null;
    }
    }
    
    


  • Alors la cause la plus problable du NullPointerException est que "ExtendedEntityPropCaracteristique.get(player)" retourne null (ligne 27), donc il faut que tu trouves pourquoi 😉



  • Merci