Crash Sac Tuto ScareX



  • Salut !

    Bizarrement je ne sais pas trop quand ça arrive mais j'ai ce crash parfois :

    –-- Minecraft Crash Report ----
    // Everything's going to plan. No, really, that was supposed to happen.

    Time: 03/01/16 12:45
    Description: Exception in server tick loop

    java.lang.NullPointerException: Exception in server tick loop
    at fr.altiscraft.benjaminloison.common.ConteneurSac.writeToNBT(ConteneurSac.java:45)
    at fr.altiscraft.benjaminloison.common.ConteneurSac.func_75134_a(ConteneurSac.java:81)
    at net.minecraft.entity.player.EntityPlayer.func_70106_y(EntityPlayer.java:1512)
    at net.minecraft.world.World.func_72900_e(World.java:1865)
    at net.minecraft.server.management.ServerConfigurationManager.disconnect(ServerConfigurationManager.java:447)
    at net.minecraft.network.NetHandlerPlayServer.func_147231_a(NetHandlerPlayServer.java:945)
    at net.minecraft.network.NetworkSystem.func_151269_c(NetworkSystem.java:162)
    at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:991)
    at net.minecraft.server.dedicated.DedicatedServer.func_71190_q(DedicatedServer.java:431)
    at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:809)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:669)
    at java.lang.Thread.run(Thread.java:745)

    A detailed walkthrough of the error, its code path and all known details is as follows:

    -- System Details --
    Details:
    Minecraft Version: 1.7.10
    KCauldron Version: pw.prok:KCauldron:1.7.10-1492.155
    Operating System: Linux (amd64) version 3.14.32-xxxx-std-ipv6-64-hz1000
    Java Version: 1.8.0_60, Oracle Corporation
    Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
    Memory: 337280320 bytes (321 MB) / 872185856 bytes (831 MB) up to 6227755008 bytes (5939 MB)
    JVM Flags: 20 total; -Xincgc -XX:+UseParNewGC -XX:MaxPermSize=256M -XX:NewRatio=2 -XX:CMSFullGCsBeforeCompaction=1 -XX:+UseConcMarkSweepGC -XX:SoftRefLRUPolicyMSPerMB=2048 -XX:+CMSParallelRemarkEnabled -XX:+DisableExplicitGC -Xnoclassgc -Xoss4M -Xss4M -XX:+UseFastAccessorMethods -XX:CMSInitiatingOccupancyFraction=90 -XX:UseSSE=4 -XX:+UseCMSCompactAtFullCollection -XX:ParallelGCThreads=4 -XX:+AggressiveOpts -Xmx6144M -Xms512M
    AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
    IntCache: cache: 0, tcache: 0, allocated: 13, tallocated: 103
    FML: MCP v9.05 FML v7.10.99.99 Minecraft Forge 10.13.4.1492 11 mods loaded, 11 mods active
    States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored
    UCHIJAAAA mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) 
    UCHIJAAAA FML{7.10.99.99} [Forge Mod Loader] (OpenMod-Prov2.jar) 
    UCHIJAAAA Forge{10.13.4.1492} [Minecraft Forge] (OpenMod-Prov2.jar) 
    UCHIJAAAA kimagine{0.1} [KImagine] (minecraft.jar) 
    UCHIJAAAA flansmod{@VERSION@} [Flan's Mod] (AltisCraft.fr.jar) 
    UCHIJAAAA altiscraft.MODID{1.0.0} [AltisCraft.fr] (AltisCraft.fr.jar) 
    UCHIJAAAA t4pro{1.0.1} [Project] (AltisCraft.fr.jar) 
    UCHIJAAAA CarpentersBlocks{0.0.1 Beta} [AltisCraft.fr] (AltisCraft.fr.jar) 
    UCHIJAAAA thirstmod{1.8.14} [Thirst Mod] (AltisCraft.fr.jar) 
    UCHIJAAAA Dynmap{2.2-143} [Dynmap] (Dynmap-2.2-forge-1.7.10.jar) 
    UCHIJAAAA gvc{0.6.1} [�aGliby's�f Voice Chat Mod] (GlibysVC-1.7.10-0.6.2a.jar) 
    Profiler Position: N/A (disabled)
    Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
    Player Count: 25 / 250; [EntityPlayerMP['Droneur_Froin'/103, l='AltisCraft', x=-8380,70, y=49,00, z=-3650,70](Droneur_Froin at -8380.699999988079,49.0,-3650.699999988079), EntityPlayerMP['Gaylor_Bertrand'/526, l='AltisCraft', x=-8161,25, y=17,00, z=-3869,70](Gaylor_Bertrand at -8161.2517668293585,17.0,-3869.699999988079), EntityPlayerMP['Sqynox_Teams'/884, l='AltisCraft', x=-8538,83, y=33,00, z=-3641,24](Sqynox_Teams at -8538.833234795768,33.0,-3641.238234461239), EntityPlayerMP['Donio_Xorm'/1093, l='AltisCraft', x=-8474,31, y=29,00, z=-3696,40](Donio_Xorm at -8474.307321775705,29.0,-3696.4017093495477), EntityPlayerMP['Louis_Leroy'/1197, l='AltisCraft', x=-8610,55, y=14,00, z=-3142,24](Louis_Leroy at -8610.55119245434,14.0,-3142.236076928412), EntityPlayerMP['Rich_Tofen'/1224, l='AltisCraft', x=-8602,01, y=54,67, z=-2928,49](Rich_Tofen at -8602.008170740926,54.6696469487033,-2928.490243010757), EntityPlayerMP['Nicolas_Boucher'/2151, l='AltisCraft', x=-8515,70, y=34,00, z=-3760,68](Nicolas_Boucher at -8515.699999988079,34.0,-3760.676425764301), EntityPlayerMP['Fluxx_Mister'/2167, l='AltisCraft', x=-8379,47, y=49,00, z=-3649,58](Fluxx_Mister at -8379.470173004791,49.0,-3649.579699062899), EntityPlayerMP['Valentin_Nqsh'/2318, l='AltisCraft', x=-8505,54, y=33,00, z=-3862,54](Valentin_Nqsh at -8505.53864552627,33.0,-3862.543100714587), EntityPlayerMP['Duong_Pikamon'/2740, l='AltisCraft', x=-8335,70, y=33,00, z=-3651,50](Duong_Pikamon at -8335.699999988079,33.0,-3651.4968998106856), EntityPlayerMP['Anakin_Vador'/2819, l='AltisCraft', x=-8336,41, y=34,00, z=-3652,75](Anakin_Vador at -8336.409161721913,34.0,-3652.746651252988), EntityPlayerMP['Manoir_Titi'/3200, l='AltisCraft', x=-8391,30, y=33,00, z=-3731,79](Manoir_Titi at -8391.30037674518,33.0,-3731.792382261317), EntityPlayerMP['Louis_Bg'/3233, l='AltisCraft', x=-8495,16, y=33,00, z=-3657,87](Louis_Bg at -8495.162529049372,33.0,-3657.8660335961863), EntityPlayerMP['Dylan_Lachaise'/3454, l='AltisCraft', x=-8371,23, y=53,00, z=-3651,30](Dylan_Lachaise at -8371.225757878185,53.0,-3651.2971453198174), EntityPlayerMP['Mateo_Demon'/3546, l='AltisCraft', x=-8367,71, y=33,00, z=-3695,62](Mateo_Demon at -8367.707644772949,33.0,-3695.623961902578), EntityPlayerMP['El_Diablos'/3706, l='AltisCraft', x=-8368,65, y=33,00, z=-3675,36](El_Diablos at -8368.65488565522,33.0,-3675.3642693206493), EntityPlayerMP['Francis_Franc'/3868, l='AltisCraft', x=-8613,54, y=15,62, z=-3136,52](Francis_Franc at -8613.53841582156,15.623586415797472,-3136.521731982535), EntityPlayerMP['Eclipse_Prod'/4231, l='AltisCraft', x=-8751,67, y=25,00, z=-3110,04](Eclipse_Prod at -8751.667163417915,25.0,-3110.038569467793), EntityPlayerMP['Barack_Afritt'/4516, l='AltisCraft', x=-8498,71, y=34,00, z=-3753,65](Barack_Afritt at -8498.71483316313,34.0,-3753.6478909741218), EntityPlayerMP['Teakenn_Demon'/4644, l='AltisCraft', x=-8512,20, y=33,00, z=-3743,45](Teakenn_Demon at -8512.19810523928,33.0,-3743.4454133694735), EntityPlayerMP['Gabriel_Gulard'/4811, l='AltisCraft', x=-8509,48, y=33,00, z=-3871,77](Gabriel_Gulard at -8509.482724586853,33.0,-3871.7693261927766), EntityPlayerMP['Camille_Deguis'/5226, l='AltisCraft', x=-8514,74, y=33,00, z=-3820,72](Camille_Deguis at -8514.741102806003,33.0,-3820.7225706707704), EntityPlayerMP['Benjamin_Loison'/5906, l='AltisCraft', x=-8929,65, y=60,96, z=-3785,06](Benjamin_Loison at -8929.648836884364,60.96175003933388,-3785.060444785596), EntityPlayerMP['Maxime_Vernant'/6001, l='AltisCraft', x=-8504,77, y=34,75, z=-3919,60](Maxime_Vernant at -8504.766099531122,34.7531999805212,-3919.598151739543), EntityPlayerMP['Slash_Eaz'/6042, l='AltisCraft', x=-8524,00, y=33,00, z=-3802,00](Slash_Eaz at -8524.0,33.0,-3802.0)]
    Is Modded: Definitely; Server brand changed to 'kcauldron,cauldron,craftbukkit,mcpc,fml,forge'
    Type: Dedicated Server (map_server.txt)

    Alors que j'ai très bien suivit le tuto de ScareX sur les Sacs voici ma classe qui marche très bien sauf quand crash ^^ :

    package fr.altiscraft.benjaminloison.common;
    
    import net.minecraft.entity.player.EntityPlayer;
    import net.minecraft.entity.player.InventoryPlayer;
    import net.minecraft.inventory.Container;
    import net.minecraft.inventory.Slot;
    import net.minecraft.item.ItemStack;
    import net.minecraft.nbt.NBTTagCompound;
    
    public class ConteneurSac extends Container
    {
    public InventaireSac invBackpack;
    public int rows;
    
    public ConteneurSac(InventoryPlayer playerInv, InventaireSac inv) {
    this.invBackpack = inv;
    this.rows = inv.getSizeInventory() / 9;
    int i = (this.rows - 4) * 18;
    int j;
    int k;
    
    for (j = 0; j < this.rows; ++j) {
    for (k = 0; k < 9; ++k) {
    this.addSlotToContainer(new SacSlot(inv, k + j * 9, 8 + k * 18, 18 + j * 18));
    }
    }
    
    for (j = 0; j < 3; ++j) {
    for (k = 0; k < 9; ++k) {
    this.addSlotToContainer(new Slot(playerInv, k + j * 9 + 9, 8 + k * 18, 103 + j * 18 + i));
    }
    }
    
    for (j = 0; j < 9; ++j) {
    this.addSlotToContainer(new Slot(playerInv, j, 8 + j * 18, 161 + i));
    }
    }
    
    @Override
    public boolean canInteractWith(EntityPlayer player) {
    return true;
    }
    
    public void writeToNBT(ItemStack stack) {
    if (!stack.hasTagCompound()) stack.setTagCompound(new NBTTagCompound());
    invBackpack.writeToNBT(stack.getTagCompound());
    }
    
    @Override
    public ItemStack transferStackInSlot(EntityPlayer player, int index) {
    ItemStack itemstack = null;
    Slot slot = (Slot) this.inventorySlots.get(index);
    
    if (slot != null && slot.getHasStack()) {
    ItemStack itemstack1 = slot.getStack();
    itemstack = itemstack1.copy();
    if (itemstack.getItem() instanceof Sac) return null;
    
    if (index < this.invBackpack.getSizeInventory()) {
    if (!this.mergeItemStack(itemstack1, this.invBackpack.getSizeInventory(), this.inventorySlots.size(), true)) return null;
    } else if (!this.mergeItemStack(itemstack1, 0, this.invBackpack.getSizeInventory(), false)) { return null; }
    
    if (itemstack1.stackSize == 0)
    slot.putStack((ItemStack) null);
    else
    slot.onSlotChanged();
    }
    
    return itemstack;
    }
    
    @Override
    public ItemStack slotClick(int slotIndex, int buttonPressed, int flag, EntityPlayer player) {
    if (flag == 2 && buttonPressed == player.inventory.currentItem) return null;
    if (slotIndex - this.invBackpack.getSizeInventory() - 27 == player.inventory.currentItem) return null;
    return super.slotClick(slotIndex, buttonPressed, flag, player);
    }
    
    @Override
    public void onContainerClosed(EntityPlayer player) {
    this.writeToNBT(player.getHeldItem());
    super.onContainerClosed(player);
    }
    }
    

    Je ne comprends pas le NPE, sur un booléen ?


  • Administrateurs

    if (!stack.hasTagCompound()) stack.setTagCompound(new NBTTagCompound());
    Je pense que stack est null.
    La fonction writeToNBT est appelé où ?