Capabalities ошибка

Версия Minecraft
1.12.2
API
Forge
16
1
0
Привет пытаюсь сделать своё capabalities. Когда пытаюсь прикрепить к игроку вылазит ошибка.
Вот все классы:
Imana:
package com.example.examplemod.capabilities;

public interface IMana {

    public void setMana(int mana);

    public int getMana();
}
Mana:
package com.example.examplemod.capabilities;

public class Mana implements IMana{

    private int mana = 1;

    @Override
    public void setMana(int mana) {
        this.mana = mana;
    }

    @Override
    public int getMana() {
        return this.mana;
    }
}
ManaProvider:
package com.example.examplemod.capabilities;

import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.capabilities.CapabilityInject;
import net.minecraftforge.common.capabilities.ICapabilitySerializable;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;

public class ManaProvider implements ICapabilitySerializable<NBTTagCompound> {


    @CapabilityInject(IMana.class)
    public static final Capability<IMana> MANA_CAPABILITY = null;
    private final IMana capability = new Mana();

    @Override
    public boolean hasCapability(@Nonnull Capability<?> capability, @Nullable EnumFacing facing) {
        return capability == MANA_CAPABILITY;
    }

    @Nullable
    @Override
    @SuppressWarnings("unchecked")
    public <T> T getCapability(@Nonnull Capability<T> capability, @Nullable EnumFacing facing) {
        if ((MANA_CAPABILITY != null) && (capability == MANA_CAPABILITY)) return (T) this.capability;
        return null;
    }

    @Override
    public NBTTagCompound serializeNBT() {
        return (NBTTagCompound) ManaStorage.INSTANCE.writeNBT(ManaProvider.MANA_CAPABILITY, new Mana(), null);
    }

    @Override
    public void deserializeNBT(NBTTagCompound nbt) {
        ManaStorage.INSTANCE.readNBT(ManaProvider.MANA_CAPABILITY, new Mana(), null, nbt);
    }
}
ManaStorage:
package com.example.examplemod.capabilities;

import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.capabilities.Capability.IStorage;

import javax.annotation.Nullable;

public class ManaStorage implements IStorage<IMana> {

    public static final ManaStorage INSTANCE = new ManaStorage();

    @Nullable
    @Override
    public NBTBase writeNBT(Capability<IMana> capability, IMana instance, EnumFacing side) {
        NBTTagCompound nbt = new NBTTagCompound();
        nbt.setInteger("maxMana",instance.getMana());
        return null;
    }

    @Override
    public void readNBT(Capability<IMana> capability, IMana instance, EnumFacing side, NBTBase nbt) {
        NBTTagCompound tag = (NBTTagCompound) nbt;
        instance.setMana(tag.getInteger("maxMana"));
    }
}
Handler:
package com.example.examplemod.util.handlers;

import com.example.examplemod.capabilities.ManaProvider;
import com.example.examplemod.util.Reference;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.event.AttachCapabilitiesEvent;

import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;

import java.util.Locale;


@Mod.EventBusSubscriber
public class Handler {


    @SubscribeEvent
    public static void attachEntity(AttachCapabilitiesEvent<Entity> event) {
        if (event.getObject() instanceof EntityPlayer) {
            ManaProvider manaCap = new ManaProvider();

            event.addCapability(new ResourceLocation(Reference.MODID, "mana_capability"), manaCap);

        }
    }

}
Быстрее всего напутал что-то с nbt. Помогите пожалуйста.
 
Краш-лог
[20:10:17] [Server thread/INFO] [minecraft/MinecraftServer]: Preparing spawn area: 10%
[20:10:19] [Server thread/INFO] [minecraft/MinecraftServer]: Preparing spawn area: 23%
[20:10:20] [Server thread/INFO] [minecraft/MinecraftServer]: Preparing spawn area: 34%
[20:10:21] [Server thread/INFO] [minecraft/MinecraftServer]: Preparing spawn area: 41%
[20:10:22] [Server thread/INFO] [minecraft/MinecraftServer]: Preparing spawn area: 52%
[20:10:23] [Server thread/INFO] [minecraft/MinecraftServer]: Preparing spawn area: 68%
[20:10:24] [Server thread/INFO] [minecraft/MinecraftServer]: Preparing spawn area: 87%
[20:10:24] [Server thread/DEBUG] [FML]: Bar Step: ServerStarting - Minecraft took 0.000s
[20:10:24] [Server thread/DEBUG] [FML]: Bar Step: ServerStarting - Minecraft Coder Pack took 0.000s
[20:10:24] [Server thread/DEBUG] [FML]: Bar Step: ServerStarting - Forge Mod Loader took 0.000s
[20:10:24] [Server thread/DEBUG] [FML]: Bar Step: ServerStarting - Minecraft Forge took 0.030s
[20:10:24] [Server thread/DEBUG] [FML]: Bar Step: ServerStarting - TestMod took 0.000s
[20:10:24] [Server thread/DEBUG] [FML]: Bar Finished: ServerStarting took 0.031s
[20:10:24] [Server thread/DEBUG] [FML]: Bar Step: ServerStarted - Minecraft took 0.000s
[20:10:24] [Server thread/DEBUG] [FML]: Bar Step: ServerStarted - Minecraft Coder Pack took 0.000s
[20:10:24] [Server thread/DEBUG] [FML]: Bar Step: ServerStarted - Forge Mod Loader took 0.000s
[20:10:24] [Server thread/DEBUG] [FML]: Bar Step: ServerStarted - Minecraft Forge took 0.000s
[20:10:24] [Server thread/DEBUG] [FML]: Bar Step: ServerStarted - TestMod took 0.000s
[20:10:24] [Server thread/DEBUG] [FML]: Bar Finished: ServerStarted took 0.000s
[20:10:24] [Server thread/DEBUG] [FML]: Queueing dimension -1 to unload
[20:10:24] [Server thread/DEBUG] [FML]: Queueing dimension 1 to unload
[20:10:24] [Server thread/INFO] [FML]: Unloading dimension -1
[20:10:24] [Server thread/INFO] [FML]: Unloading dimension 1
[20:10:24] [Server thread/INFO] [minecraft/IntegratedServer]: Changing view distance to 12, from 10
[20:10:26] [Netty Local Client IO #0/DEBUG] [FML]: FMLHandshakeClientState: null->FMLHandshakeClientState$1:START
[20:10:26] [Netty Local Client IO #0/DEBUG] [FML]: Next: HELLO
[20:10:26] [Server thread/DEBUG] [FML]: FMLHandshakeServerState: null->FMLHandshakeServerState$1:START
[20:10:26] [Server thread/DEBUG] [FML]: Next: HELLO
[20:10:26] [Netty Local Client IO #0/DEBUG] [FML]: Server FML protocol version 2, 4 byte dimension received 0
[20:10:26] [Netty Local Client IO #0/DEBUG] [FML]: FMLHandshakeClientState: $ServerHello->FMLHandshakeClientState$2:HELLO
[20:10:26] [Netty Local Client IO #0/DEBUG] [FML]: Next: WAITINGSERVERDATA
[20:10:26] [Netty Local Client IO #0/INFO] [FML]: Server protocol version 2
[20:10:26] [Netty Local Client IO #0/DEBUG] [FML]: Received override dimension 0
[20:10:26] [Netty Server IO #1/DEBUG] [FML]: FMLHandshakeServerState: $ClientHello->FMLHandshakeServerState$2:HELLO
[20:10:26] [Netty Server IO #1/INFO] [FML]: Client protocol version 2
[20:10:26] [Netty Server IO #1/DEBUG] [FML]: FMLHandshakeServerState: $ModList:5 mods->FMLHandshakeServerState$2:HELLO
[20:10:26] [Netty Server IO #1/INFO] [FML]: Client attempting to join with 5 mods : [email protected],[email protected],[email protected],[email protected],[email protected]
[20:10:26] [Netty Server IO #1/DEBUG] [FML]: Next: WAITINGCACK
[20:10:26] [Netty Local Client IO #0/DEBUG] [FML]: FMLHandshakeClientState: $ModList:5 mods->FMLHandshakeClientState$3:WAITINGSERVERDATA
[20:10:26] [Netty Local Client IO #0/DEBUG] [FML]: Next: PENDINGCOMPLETE
[20:10:26] [Netty Server IO #1/DEBUG] [FML]: FMLHandshakeServerState: $HandshakeAck:{2}->FMLHandshakeServerState$3:WAITINGCACK
[20:10:26] [Netty Server IO #1/DEBUG] [FML]: Next: COMPLETE
[20:10:26] [Netty Local Client IO #0/DEBUG] [FML]: FMLHandshakeClientState: $HandshakeAck:{2}->FMLHandshakeClientState$5:PENDINGCOMPLETE
[20:10:26] [Netty Local Client IO #0/DEBUG] [FML]: Next: COMPLETE
[20:10:26] [Netty Server IO #1/DEBUG] [FML]: FMLHandshakeServerState: $HandshakeAck:{4}->FMLHandshakeServerState$4:COMPLETE
[20:10:26] [Netty Server IO #1/DEBUG] [FML]: Next: DONE
[20:10:26] [Netty Local Client IO #0/DEBUG] [FML]: The fluid minecraft:lava has been selected as the default fluid for lava
[20:10:26] [Netty Local Client IO #0/DEBUG] [FML]: The fluid minecraft:water has been selected as the default fluid for water
[20:10:26] [Netty Local Client IO #0/DEBUG] [FML]: FMLHandshakeClientState: $HandshakeAck:{3}->FMLHandshakeClientState$6:COMPLETE
[20:10:26] [Netty Local Client IO #0/DEBUG] [FML]: Next: DONE
[20:10:26] [Netty Server IO #1/DEBUG] [FML]: FMLHandshakeServerState: $HandshakeAck:{5}->FMLHandshakeServerState$5:DONE
[20:10:26] [Server thread/INFO] [FML]: [Server thread] Server side modded connection established
[20:10:26] [Netty Local Client IO #0/INFO] [FML]: [Netty Local Client IO #0] Client side modded connection established
[20:10:26] [Server thread/INFO] [minecraft/PlayerList]: Player843[local:E:74d82114] logged in with entity id 2453 at (-167.5, 61.0, 244.5)
[20:10:26] [Server thread/INFO] [minecraft/MinecraftServer]: Player843 joined the game
[20:10:26] [Client thread/DEBUG] [FML]: Overriding dimension: using 0
[20:10:27] [Server thread/INFO] [minecraft/IntegratedServer]: Saving and pausing game...
[20:10:27] [Server thread/ERROR] [minecraft/MinecraftServer]: Encountered an unexpected exception
net.minecraft.util.ReportedException: Saving entity NBT
at net.minecraft.entity.Entity.writeToNBT(Entity.java:1772) ~[Entity.class:?]
at net.minecraft.server.integrated.IntegratedPlayerList.writePlayerData(IntegratedPlayerList.java:26) ~[IntegratedPlayerList.class:?]
at net.minecraft.server.management.PlayerList.saveAllPlayerData(PlayerList.java:943) ~[PlayerList.class:?]
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:169) ~[IntegratedServer.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:526) [MinecraftServer.class:?]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_282]
Caused by: java.lang.IllegalArgumentException: Invalid null NBT value with key testmod:mana_capability
at net.minecraft.nbt.NBTTagCompound.setTag(NBTTagCompound.java:85) ~[NBTTagCompound.class:?]
at net.minecraftforge.common.capabilities.CapabilityDispatcher.serializeNBT(CapabilityDispatcher.java:123) ~[CapabilityDispatcher.class:?]
at net.minecraft.entity.Entity.writeToNBT(Entity.java:1741) ~[Entity.class:?]
... 5 more
[20:10:27] [Server thread/ERROR] [minecraft/MinecraftServer]: This crash report has been saved to: C:\Users\***\Desktop\Forge\run\.\crash-reports\crash-2021-04-10_20.10.27-server.txt
[20:10:27] [Server thread/INFO] [minecraft/MinecraftServer]: Stopping server
[20:10:27] [Server thread/INFO] [minecraft/MinecraftServer]: Saving players
[20:10:27] [Server thread/ERROR] [minecraft/MinecraftServer]: Exception stopping the server
net.minecraft.util.ReportedException: Saving entity NBT
at net.minecraft.entity.Entity.writeToNBT(Entity.java:1772) ~[Entity.class:?]
at net.minecraft.server.integrated.IntegratedPlayerList.writePlayerData(IntegratedPlayerList.java:26) ~[IntegratedPlayerList.class:?]
at net.minecraft.server.management.PlayerList.saveAllPlayerData(PlayerList.java:943) ~[PlayerList.class:?]
at net.minecraft.server.MinecraftServer.stopServer(MinecraftServer.java:430) ~[MinecraftServer.class:?]
at net.minecraft.server.integrated.IntegratedServer.stopServer(IntegratedServer.java:372) ~[IntegratedServer.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:579) [MinecraftServer.class:?]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_282]
Caused by: java.lang.IllegalArgumentException: Invalid null NBT value with key testmod:mana_capability
at net.minecraft.nbt.NBTTagCompound.setTag(NBTTagCompound.java:85) ~[NBTTagCompound.class:?]
at net.minecraftforge.common.capabilities.CapabilityDispatcher.serializeNBT(CapabilityDispatcher.java:123) ~[CapabilityDispatcher.class:?]
at net.minecraft.entity.Entity.writeToNBT(Entity.java:1741) ~[Entity.class:?]
... 6 more
[20:10:27] [Server thread/DEBUG] [FML]: Reverting to frozen data state.
[20:10:27] [Server thread/DEBUG] [FML]: Bar Step: ModIdMapping - Minecraft took 0.000s
[20:10:27] [Server thread/DEBUG] [FML]: Bar Step: ModIdMapping - Minecraft Coder Pack took 0.000s
[20:10:27] [Server thread/DEBUG] [FML]: Bar Step: ModIdMapping - Forge Mod Loader took 0.000s
Caused by: java.lang.IllegalArgumentException: Invalid null NBT value with key testmod:mana_capability

[20:10:27] [Server thread/DEBUG] [FML]: Bar Step: ModIdMapping - Minecraft Forge took 0.057s
[20:10:27] [Server thread/DEBUG] [FML]: Bar Step: ModIdMapping - TestMod took 0.000s
[20:10:27] [Server thread/DEBUG] [FML]: Bar Finished: ModIdMapping took 0.058s
[20:10:27] [Server thread/INFO] [FML]: Applying holder lookups
[20:10:27] [Server thread/INFO] [FML]: Holder lookups applied
[20:10:27] [Server thread/DEBUG] [FML]: Frozen state restored.
[20:10:27] [Server thread/DEBUG] [FML]: Bar Step: ServerStopped - Minecraft took 0.000s
[20:10:27] [Server thread/DEBUG] [FML]: Bar Step: ServerStopped - Minecraft Coder Pack took 0.000s
[20:10:27] [Server thread/DEBUG] [FML]: Bar Step: ServerStopped - Forge Mod Loader took 0.000s
[20:10:27] [Server thread/DEBUG] [FML]: Bar Step: ServerStopped - Minecraft Forge took 0.000s
[20:10:27] [Server thread/DEBUG] [FML]: Bar Step: ServerStopped - TestMod took 0.000s
[20:10:27] [Server thread/DEBUG] [FML]: Bar Finished: ServerStopped took 0.001s
[20:10:27] [Server thread/INFO] [FML]: The state engine was in incorrect state SERVER_STOPPING and forced into state SERVER_STOPPED. Errors may have been discarded.
[20:10:27] [Client thread/INFO] [STDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:553]: ---- Minecraft Crash Report ----
// My bad.

Time: 4/10/21 8:10 PM
Description: Saving entity NBT

java.lang.IllegalArgumentException: Invalid null NBT value with key testmod:mana_capability
at net.minecraft.nbt.NBTTagCompound.setTag(NBTTagCompound.java:85)
at net.minecraftforge.common.capabilities.CapabilityDispatcher.serializeNBT(CapabilityDispatcher.java:123)
at net.minecraft.entity.Entity.writeToNBT(Entity.java:1741)
at net.minecraft.server.integrated.IntegratedPlayerList.writePlayerData(IntegratedPlayerList.java:26)
at net.minecraft.server.management.PlayerList.saveAllPlayerData(PlayerList.java:943)
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:169)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:526)
at java.lang.Thread.run(Thread.java:748)


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

-- Head --
Thread: Client thread
Stacktrace:
at net.minecraft.nbt.NBTTagCompound.setTag(NBTTagCompound.java:85)
at net.minecraftforge.common.capabilities.CapabilityDispatcher.serializeNBT(CapabilityDispatcher.java:123)

-- Entity being saved --
Details:
Entity Type: null (net.minecraft.entity.player.EntityPlayerMP)
Entity ID: 2453
Entity Name: Player843
Entity's Exact location: -167.50, 61.00, 244.50
Entity's Block location: World: (-168,61,244), Chunk: (at 8,3,4 in -11,15; contains blocks -176,0,240 to -161,255,255), Region: (-1,0; contains chunks -32,0 to -1,31, blocks -512,0,0 to -1,255,511)
Entity's Momentum: 0.00, -0.02, 0.00
Entity's Passengers: []
Entity's Vehicle: ~~ERROR~~ NullPointerException: null
Stacktrace:
at net.minecraft.entity.Entity.writeToNBT(Entity.java:1741)
at net.minecraft.server.integrated.IntegratedPlayerList.writePlayerData(IntegratedPlayerList.java:26)
at net.minecraft.server.management.PlayerList.saveAllPlayerData(PlayerList.java:943)
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:169)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:526)
at java.lang.Thread.run(Thread.java:748)

-- System Details --
Details:
Minecraft Version: 1.12.2
Operating System: Windows 10 (amd64) version 10.0
Java Version: 1.8.0_282, Amazon.com Inc.
Java VM Version: OpenJDK 64-Bit Server VM (mixed mode), Amazon.com Inc.
Memory: 1422879912 bytes (1356 MB) / 1703936000 bytes (1625 MB) up to 7622623232 bytes (7269 MB)
JVM Flags: 0 total;
IntCache: cache: 1, tcache: 1, allocated: 12, tallocated: 94
FML: MCP 9.42 Powered by Forge 14.23.5.2854 5 mods loaded, 5 mods active
States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored

| State | ID | Version | Source | Signature |
|:------ |:--------- |:------------ |:------------------------------------------------------------------ |:--------- |
| LCHIJA | minecraft | 1.12.2 | minecraft.jar | None |
| LCHIJA | mcp | 9.42 | minecraft.jar | None |
| LCHIJA | FML | 8.0.99.99 | forge-1.12.2-14.23.5.2854_mapped_snapshot_20171003-1.12-recomp.jar | None |
| LCHIJA | forge | 14.23.5.2854 | forge-1.12.2-14.23.5.2854_mapped_snapshot_20171003-1.12-recomp.jar | None |
| LCHIJA | testmod | 1.12.2 | main | None |

Loaded coremods (and transformers):
GL info: ~~ERROR~~ RuntimeException: No OpenGL context found in the current thread.
Profiler Position: N/A (disabled)
Player Count: 1 / 8; [EntityPlayerMP['Player843'/2453, l='New World', x=-167.50, y=61.00, z=244.50]]
Type: Integrated Server (map_client.txt)
Is Modded: Definitely; Client brand changed to 'fml,forge'
[20:10:27] [Client thread/INFO] [STDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:553]: #@!@# Game crashed! Crash report saved to: #@!@# .\crash-reports\crash-2021-04-10_20.10.27-server.txt
[20:10:27] [Client Shutdown Thread/INFO] [minecraft/MinecraftServer]: Stopping server
Exception in thread "Client Shutdown Thread" AL lib: (EE) alc_cleanup: 1 device not closed
Краш-лог:
[20:10:17] [Server thread/INFO] [minecraft/MinecraftServer]: Preparing spawn area: 10%
[20:10:19] [Server thread/INFO] [minecraft/MinecraftServer]: Preparing spawn area: 23%
[20:10:20] [Server thread/INFO] [minecraft/MinecraftServer]: Preparing spawn area: 34%
[20:10:21] [Server thread/INFO] [minecraft/MinecraftServer]: Preparing spawn area: 41%
[20:10:22] [Server thread/INFO] [minecraft/MinecraftServer]: Preparing spawn area: 52%
[20:10:23] [Server thread/INFO] [minecraft/MinecraftServer]: Preparing spawn area: 68%
[20:10:24] [Server thread/INFO] [minecraft/MinecraftServer]: Preparing spawn area: 87%
[20:10:24] [Server thread/DEBUG] [FML]: Bar Step: ServerStarting - Minecraft took 0.000s
[20:10:24] [Server thread/DEBUG] [FML]: Bar Step: ServerStarting - Minecraft Coder Pack took 0.000s
[20:10:24] [Server thread/DEBUG] [FML]: Bar Step: ServerStarting - Forge Mod Loader took 0.000s
[20:10:24] [Server thread/DEBUG] [FML]: Bar Step: ServerStarting - Minecraft Forge took 0.030s
[20:10:24] [Server thread/DEBUG] [FML]: Bar Step: ServerStarting - TestMod took 0.000s
[20:10:24] [Server thread/DEBUG] [FML]: Bar Finished: ServerStarting took 0.031s
[20:10:24] [Server thread/DEBUG] [FML]: Bar Step: ServerStarted - Minecraft took 0.000s
[20:10:24] [Server thread/DEBUG] [FML]: Bar Step: ServerStarted - Minecraft Coder Pack took 0.000s
[20:10:24] [Server thread/DEBUG] [FML]: Bar Step: ServerStarted - Forge Mod Loader took 0.000s
[20:10:24] [Server thread/DEBUG] [FML]: Bar Step: ServerStarted - Minecraft Forge took 0.000s
[20:10:24] [Server thread/DEBUG] [FML]: Bar Step: ServerStarted - TestMod took 0.000s
[20:10:24] [Server thread/DEBUG] [FML]: Bar Finished: ServerStarted took 0.000s
[20:10:24] [Server thread/DEBUG] [FML]: Queueing dimension -1 to unload
[20:10:24] [Server thread/DEBUG] [FML]: Queueing dimension 1 to unload
[20:10:24] [Server thread/INFO] [FML]: Unloading dimension -1
[20:10:24] [Server thread/INFO] [FML]: Unloading dimension 1
[20:10:24] [Server thread/INFO] [minecraft/IntegratedServer]: Changing view distance to 12, from 10
[20:10:26] [Netty Local Client IO #0/DEBUG] [FML]: FMLHandshakeClientState: null->FMLHandshakeClientState$1:START
[20:10:26] [Netty Local Client IO #0/DEBUG] [FML]:   Next: HELLO
[20:10:26] [Server thread/DEBUG] [FML]: FMLHandshakeServerState: null->FMLHandshakeServerState$1:START
[20:10:26] [Server thread/DEBUG] [FML]:   Next: HELLO
[20:10:26] [Netty Local Client IO #0/DEBUG] [FML]: Server FML protocol version 2, 4 byte dimension received 0
[20:10:26] [Netty Local Client IO #0/DEBUG] [FML]: FMLHandshakeClientState: $ServerHello->FMLHandshakeClientState$2:HELLO
[20:10:26] [Netty Local Client IO #0/DEBUG] [FML]:   Next: WAITINGSERVERDATA
[20:10:26] [Netty Local Client IO #0/INFO] [FML]: Server protocol version 2
[20:10:26] [Netty Local Client IO #0/DEBUG] [FML]: Received override dimension 0
[20:10:26] [Netty Server IO #1/DEBUG] [FML]: FMLHandshakeServerState: $ClientHello->FMLHandshakeServerState$2:HELLO
[20:10:26] [Netty Server IO #1/INFO] [FML]: Client protocol version 2
[20:10:26] [Netty Server IO #1/DEBUG] [FML]: FMLHandshakeServerState: $ModList:5 mods->FMLHandshakeServerState$2:HELLO
[20:10:26] [Netty Server IO #1/INFO] [FML]: Client attempting to join with 5 mods : [email protected],[email protected],[email protected],[email protected],[email protected]
[20:10:26] [Netty Server IO #1/DEBUG] [FML]:   Next: WAITINGCACK
[20:10:26] [Netty Local Client IO #0/DEBUG] [FML]: FMLHandshakeClientState: $ModList:5 mods->FMLHandshakeClientState$3:WAITINGSERVERDATA
[20:10:26] [Netty Local Client IO #0/DEBUG] [FML]:   Next: PENDINGCOMPLETE
[20:10:26] [Netty Server IO #1/DEBUG] [FML]: FMLHandshakeServerState: $HandshakeAck:{2}->FMLHandshakeServerState$3:WAITINGCACK
[20:10:26] [Netty Server IO #1/DEBUG] [FML]:   Next: COMPLETE
[20:10:26] [Netty Local Client IO #0/DEBUG] [FML]: FMLHandshakeClientState: $HandshakeAck:{2}->FMLHandshakeClientState$5:PENDINGCOMPLETE
[20:10:26] [Netty Local Client IO #0/DEBUG] [FML]:   Next: COMPLETE
[20:10:26] [Netty Server IO #1/DEBUG] [FML]: FMLHandshakeServerState: $HandshakeAck:{4}->FMLHandshakeServerState$4:COMPLETE
[20:10:26] [Netty Server IO #1/DEBUG] [FML]:   Next: DONE
[20:10:26] [Netty Local Client IO #0/DEBUG] [FML]: The fluid minecraft:lava has been selected as the default fluid for lava
[20:10:26] [Netty Local Client IO #0/DEBUG] [FML]: The fluid minecraft:water has been selected as the default fluid for water
[20:10:26] [Netty Local Client IO #0/DEBUG] [FML]: FMLHandshakeClientState: $HandshakeAck:{3}->FMLHandshakeClientState$6:COMPLETE
[20:10:26] [Netty Local Client IO #0/DEBUG] [FML]:   Next: DONE
[20:10:26] [Netty Server IO #1/DEBUG] [FML]: FMLHandshakeServerState: $HandshakeAck:{5}->FMLHandshakeServerState$5:DONE
[20:10:26] [Server thread/INFO] [FML]: [Server thread] Server side modded connection established
[20:10:26] [Netty Local Client IO #0/INFO] [FML]: [Netty Local Client IO #0] Client side modded connection established
[20:10:26] [Server thread/INFO] [minecraft/PlayerList]: Player843[local:E:74d82114] logged in with entity id 2453 at (-167.5, 61.0, 244.5)
[20:10:26] [Server thread/INFO] [minecraft/MinecraftServer]: Player843 joined the game
[20:10:26] [Client thread/DEBUG] [FML]: Overriding dimension: using 0
[20:10:27] [Server thread/INFO] [minecraft/IntegratedServer]: Saving and pausing game...
[20:10:27] [Server thread/ERROR] [minecraft/MinecraftServer]: Encountered an unexpected exception
net.minecraft.util.ReportedException: Saving entity NBT
	at net.minecraft.entity.Entity.writeToNBT(Entity.java:1772) ~[Entity.class:?]
	at net.minecraft.server.integrated.IntegratedPlayerList.writePlayerData(IntegratedPlayerList.java:26) ~[IntegratedPlayerList.class:?]
	at net.minecraft.server.management.PlayerList.saveAllPlayerData(PlayerList.java:943) ~[PlayerList.class:?]
	at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:169) ~[IntegratedServer.class:?]
	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:526) [MinecraftServer.class:?]
	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_282]
Caused by: java.lang.IllegalArgumentException: Invalid null NBT value with key testmod:mana_capability
	at net.minecraft.nbt.NBTTagCompound.setTag(NBTTagCompound.java:85) ~[NBTTagCompound.class:?]
	at net.minecraftforge.common.capabilities.CapabilityDispatcher.serializeNBT(CapabilityDispatcher.java:123) ~[CapabilityDispatcher.class:?]
	at net.minecraft.entity.Entity.writeToNBT(Entity.java:1741) ~[Entity.class:?]
	... 5 more
[20:10:27] [Server thread/ERROR] [minecraft/MinecraftServer]: This crash report has been saved to: C:\Users\***\Desktop\Forge\run\.\crash-reports\crash-2021-04-10_20.10.27-server.txt
[20:10:27] [Server thread/INFO] [minecraft/MinecraftServer]: Stopping server
[20:10:27] [Server thread/INFO] [minecraft/MinecraftServer]: Saving players
[20:10:27] [Server thread/ERROR] [minecraft/MinecraftServer]: Exception stopping the server
net.minecraft.util.ReportedException: Saving entity NBT
	at net.minecraft.entity.Entity.writeToNBT(Entity.java:1772) ~[Entity.class:?]
	at net.minecraft.server.integrated.IntegratedPlayerList.writePlayerData(IntegratedPlayerList.java:26) ~[IntegratedPlayerList.class:?]
	at net.minecraft.server.management.PlayerList.saveAllPlayerData(PlayerList.java:943) ~[PlayerList.class:?]
	at net.minecraft.server.MinecraftServer.stopServer(MinecraftServer.java:430) ~[MinecraftServer.class:?]
	at net.minecraft.server.integrated.IntegratedServer.stopServer(IntegratedServer.java:372) ~[IntegratedServer.class:?]
	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:579) [MinecraftServer.class:?]
	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_282]
Caused by: java.lang.IllegalArgumentException: Invalid null NBT value with key testmod:mana_capability
	at net.minecraft.nbt.NBTTagCompound.setTag(NBTTagCompound.java:85) ~[NBTTagCompound.class:?]
	at net.minecraftforge.common.capabilities.CapabilityDispatcher.serializeNBT(CapabilityDispatcher.java:123) ~[CapabilityDispatcher.class:?]
	at net.minecraft.entity.Entity.writeToNBT(Entity.java:1741) ~[Entity.class:?]
	... 6 more
[20:10:27] [Server thread/DEBUG] [FML]: Reverting to frozen data state.
[20:10:27] [Server thread/DEBUG] [FML]: Bar Step: ModIdMapping - Minecraft took 0.000s
[20:10:27] [Server thread/DEBUG] [FML]: Bar Step: ModIdMapping - Minecraft Coder Pack took 0.000s
[20:10:27] [Server thread/DEBUG] [FML]: Bar Step: ModIdMapping - Forge Mod Loader took 0.000s
Caused by: java.lang.IllegalArgumentException: Invalid null NBT value with key testmod:mana_capability

[20:10:27] [Server thread/DEBUG] [FML]: Bar Step: ModIdMapping - Minecraft Forge took 0.057s
[20:10:27] [Server thread/DEBUG] [FML]: Bar Step: ModIdMapping - TestMod took 0.000s
[20:10:27] [Server thread/DEBUG] [FML]: Bar Finished: ModIdMapping took 0.058s
[20:10:27] [Server thread/INFO] [FML]: Applying holder lookups
[20:10:27] [Server thread/INFO] [FML]: Holder lookups applied
[20:10:27] [Server thread/DEBUG] [FML]: Frozen state restored.
[20:10:27] [Server thread/DEBUG] [FML]: Bar Step: ServerStopped - Minecraft took 0.000s
[20:10:27] [Server thread/DEBUG] [FML]: Bar Step: ServerStopped - Minecraft Coder Pack took 0.000s
[20:10:27] [Server thread/DEBUG] [FML]: Bar Step: ServerStopped - Forge Mod Loader took 0.000s
[20:10:27] [Server thread/DEBUG] [FML]: Bar Step: ServerStopped - Minecraft Forge took 0.000s
[20:10:27] [Server thread/DEBUG] [FML]: Bar Step: ServerStopped - TestMod took 0.000s
[20:10:27] [Server thread/DEBUG] [FML]: Bar Finished: ServerStopped took 0.001s
[20:10:27] [Server thread/INFO] [FML]: The state engine was in incorrect state SERVER_STOPPING and forced into state SERVER_STOPPED. Errors may have been discarded.
[20:10:27] [Client thread/INFO] [STDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:553]: ---- Minecraft Crash Report ----
// My bad.

Time: 4/10/21 8:10 PM
Description: Saving entity NBT

java.lang.IllegalArgumentException: Invalid null NBT value with key testmod:mana_capability
	at net.minecraft.nbt.NBTTagCompound.setTag(NBTTagCompound.java:85)
	at net.minecraftforge.common.capabilities.CapabilityDispatcher.serializeNBT(CapabilityDispatcher.java:123)
	at net.minecraft.entity.Entity.writeToNBT(Entity.java:1741)
	at net.minecraft.server.integrated.IntegratedPlayerList.writePlayerData(IntegratedPlayerList.java:26)
	at net.minecraft.server.management.PlayerList.saveAllPlayerData(PlayerList.java:943)
	at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:169)
	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:526)
	at java.lang.Thread.run(Thread.java:748)


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

-- Head --
Thread: Client thread
Stacktrace:
	at net.minecraft.nbt.NBTTagCompound.setTag(NBTTagCompound.java:85)
	at net.minecraftforge.common.capabilities.CapabilityDispatcher.serializeNBT(CapabilityDispatcher.java:123)

-- Entity being saved --
Details:
	Entity Type: null (net.minecraft.entity.player.EntityPlayerMP)
	Entity ID: 2453
	Entity Name: Player843
	Entity's Exact location: -167.50, 61.00, 244.50
	Entity's Block location: World: (-168,61,244), Chunk: (at 8,3,4 in -11,15; contains blocks -176,0,240 to -161,255,255), Region: (-1,0; contains chunks -32,0 to -1,31, blocks -512,0,0 to -1,255,511)
	Entity's Momentum: 0.00, -0.02, 0.00
	Entity's Passengers: []
	Entity's Vehicle: ~~ERROR~~ NullPointerException: null
Stacktrace:
	at net.minecraft.entity.Entity.writeToNBT(Entity.java:1741)
	at net.minecraft.server.integrated.IntegratedPlayerList.writePlayerData(IntegratedPlayerList.java:26)
	at net.minecraft.server.management.PlayerList.saveAllPlayerData(PlayerList.java:943)
	at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:169)
	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:526)
	at java.lang.Thread.run(Thread.java:748)

-- System Details --
Details:
	Minecraft Version: 1.12.2
	Operating System: Windows 10 (amd64) version 10.0
	Java Version: 1.8.0_282, Amazon.com Inc.
	Java VM Version: OpenJDK 64-Bit Server VM (mixed mode), Amazon.com Inc.
	Memory: 1422879912 bytes (1356 MB) / 1703936000 bytes (1625 MB) up to 7622623232 bytes (7269 MB)
	JVM Flags: 0 total; 
	IntCache: cache: 1, tcache: 1, allocated: 12, tallocated: 94
	FML: MCP 9.42 Powered by Forge 14.23.5.2854 5 mods loaded, 5 mods active
	States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored

	| State  | ID        | Version      | Source                                                             | Signature |
	|:------ |:--------- |:------------ |:------------------------------------------------------------------ |:--------- |
	| LCHIJA | minecraft | 1.12.2       | minecraft.jar                                                      | None      |
	| LCHIJA | mcp       | 9.42         | minecraft.jar                                                      | None      |
	| LCHIJA | FML       | 8.0.99.99    | forge-1.12.2-14.23.5.2854_mapped_snapshot_20171003-1.12-recomp.jar | None      |
	| LCHIJA | forge     | 14.23.5.2854 | forge-1.12.2-14.23.5.2854_mapped_snapshot_20171003-1.12-recomp.jar | None      |
	| LCHIJA | testmod   | 1.12.2       | main                                                               | None      |

	Loaded coremods (and transformers): 
	GL info: ~~ERROR~~ RuntimeException: No OpenGL context found in the current thread.
	Profiler Position: N/A (disabled)
	Player Count: 1 / 8; [EntityPlayerMP['Player843'/2453, l='New World', x=-167.50, y=61.00, z=244.50]]
	Type: Integrated Server (map_client.txt)
	Is Modded: Definitely; Client brand changed to 'fml,forge'
[20:10:27] [Client thread/INFO] [STDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:553]: #@!@# Game crashed! Crash report saved to: #@!@# .\crash-reports\crash-2021-04-10_20.10.27-server.txt
[20:10:27] [Client Shutdown Thread/INFO] [minecraft/MinecraftServer]: Stopping server
Exception in thread "Client Shutdown Thread" AL lib: (EE) alc_cleanup: 1 device not closed
Решение
Нашёл ошибка забывал возвращать nbt в методе writeNBT.
ManaStorage(работающий):
package com.example.examplemod.capabilities;

import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.capabilities.Capability.IStorage;

public class ManaStorage implements IStorage<IMana> {

    public static final ManaStorage INSTANCE = new ManaStorage();


    @Override
    public NBTBase writeNBT(Capability<IMana> capability, IMana instance, EnumFacing side) {
        NBTTagCompound nbt = new NBTTagCompound();
        nbt.setInteger("Mana",instance.getMana());
        return nbt;
    }

    @Override
    public void...
16
1
0
Нашёл ошибка забывал возвращать nbt в методе writeNBT.
ManaStorage(работающий):
package com.example.examplemod.capabilities;

import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.capabilities.Capability.IStorage;

public class ManaStorage implements IStorage<IMana> {

    public static final ManaStorage INSTANCE = new ManaStorage();


    @Override
    public NBTBase writeNBT(Capability<IMana> capability, IMana instance, EnumFacing side) {
        NBTTagCompound nbt = new NBTTagCompound();
        nbt.setInteger("Mana",instance.getMana());
        return nbt;
    }

    @Override
    public void readNBT(Capability<IMana> capability, IMana instance, EnumFacing side, NBTBase nbt) {
        NBTTagCompound tag = (NBTTagCompound) nbt;
        instance.setMana(tag.getInteger("Mana"));
    }
}
 
Сверху