MarkusBordihn / BOs-Player-Companions

Player Companions adds additional NPC which will follow, protect or help you...
Other
3 stars 5 forks source link

java.lang.NullPointerException: Cannot invoke "String.isEmpty()" because "p_129298_" is null #3

Closed DarkDinox closed 2 years ago

DarkDinox commented 2 years ago

Hello! I'm running a 1.18.1 minecraft server and suddenly having this issue when a player hit my companion or when I just see a new companion in the overworld

[22:29:23] [Server thread/ERROR]: Encountered an unexpected exception
net.minecraft.ReportedException: Ticking entity
    at net.minecraft.server.MinecraftServer.m_5703_(MinecraftServer.java:872) ~[server-1.18.1-20211210.034407-srg.jar%23143!/:?]
    at net.minecraft.server.dedicated.DedicatedServer.m_5703_(DedicatedServer.java:328) ~[server-1.18.1-20211210.034407-srg.jar%23143!/:?]
    at net.minecraft.server.MinecraftServer.m_5705_(MinecraftServer.java:808) ~[server-1.18.1-20211210.034407-srg.jar%23143!/:?]
    at net.minecraft.server.MinecraftServer.m_130011_(MinecraftServer.java:668) ~[server-1.18.1-20211210.034407-srg.jar%23143!/:?]
    at net.minecraft.server.MinecraftServer.m_177918_(MinecraftServer.java:258) ~[server-1.18.1-20211210.034407-srg.jar%23143!/:?]
    at java.lang.Thread.run(Thread.java:833) [?:?]
Caused by: java.lang.NullPointerException: Cannot invoke "String.isEmpty()" because "p_129298_" is null
    at net.minecraft.nbt.StringTag.m_129297_(StringTag.java:55) ~[server-1.18.1-20211210.034407-srg.jar%23143!/:?]
    at net.minecraft.nbt.CompoundTag.m_128359_(CompoundTag.java:200) ~[server-1.18.1-20211210.034407-srg.jar%23143!/:?]
    at de.markusbordihn.playercompanions.data.PlayerCompanionData.save(PlayerCompanionData.java:473) ~[player_companions_1.18.1-0.8.0.jar%23106!/:0.8.0]
    at de.markusbordihn.playercompanions.data.PlayerCompanionData.saveMetaData(PlayerCompanionData.java:457) ~[player_companions_1.18.1-0.8.0.jar%23106!/:0.8.0]
    at de.markusbordihn.playercompanions.data.PlayerCompanionsServerDataClientSync.exportPlayerCompanionData(PlayerCompanionsServerDataClientSync.java:69) ~[player_companions_1.18.1-0.8.0.jar%23106!/:0.8.0]
    at de.markusbordihn.playercompanions.data.PlayerCompanionsServerDataClientSync.syncPlayerCompanionData(PlayerCompanionsServerDataClientSync.java:42) ~[player_companions_1.18.1-0.8.0.jar%23106!/:0.8.0]
    at de.markusbordihn.playercompanions.data.PlayerCompanionsServerData.syncPlayerCompanionData(PlayerCompanionsServerData.java:297) ~[player_companions_1.18.1-0.8.0.jar%23106!/:0.8.0]
    at de.markusbordihn.playercompanions.data.PlayerCompanionsServerData.updatePlayerCompanion(PlayerCompanionsServerData.java:210) ~[player_companions_1.18.1-0.8.0.jar%23106!/:0.8.0]
    at de.markusbordihn.playercompanions.data.PlayerCompanionsServerData.updateOrRegisterCompanion(PlayerCompanionsServerData.java:177) ~[player_companions_1.18.1-0.8.0.jar%23106!/:0.8.0]
    at de.markusbordihn.playercompanions.data.PlayerCompanionsDataSync.syncData(PlayerCompanionsDataSync.java:44) ~[player_companions_1.18.1-0.8.0.jar%23106!/:0.8.0]
    at de.markusbordihn.playercompanions.data.PlayerCompanionsDataSync.syncData(PlayerCompanionsDataSync.java:21) ~[player_companions_1.18.1-0.8.0.jar%23106!/:0.8.0]
    at de.markusbordihn.playercompanions.data.PlayerCompanionsDataSync.syncDataIfNeeded(PlayerCompanionsDataSync.java:35) ~[player_companions_1.18.1-0.8.0.jar%23106!/:0.8.0]
    at de.markusbordihn.playercompanions.entity.PlayerCompanionEntityData.m_8119_(PlayerCompanionEntityData.java:635) ~[player_companions_1.18.1-0.8.0.jar%23106!/:0.8.0]
    at de.markusbordihn.playercompanions.entity.PlayerCompanionEntity.m_8119_(PlayerCompanionEntity.java:533) ~[player_companions_1.18.1-0.8.0.jar%23106!/:0.8.0]
    at de.markusbordihn.playercompanions.entity.type.guard.GuardEntityWalking.m_8119_(GuardEntityWalking.java:64) ~[player_companions_1.18.1-0.8.0.jar%23106!/:0.8.0]
    at net.minecraft.server.level.ServerLevel.m_8647_(ServerLevel.java:649) ~[server-1.18.1-20211210.034407-srg.jar%23143!/:?]
    at net.minecraft.world.level.Level.m_46653_(Level.java:487) ~[server-1.18.1-20211210.034407-srg.jar%23143!/:?]
    at net.minecraft.server.level.ServerLevel.m_184063_(ServerLevel.java:316) ~[server-1.18.1-20211210.034407-srg.jar%23143!/:?]
    at net.minecraft.world.level.entity.EntityTickList.m_156910_(EntityTickList.java:54) ~[server-1.18.1-20211210.034407-srg.jar%23143!/:?]
    at net.minecraft.server.level.ServerLevel.m_8793_(ServerLevel.java:296) ~[server-1.18.1-20211210.034407-srg.jar%23143!/:?]
    at net.minecraft.server.MinecraftServer.m_5703_(MinecraftServer.java:868) ~[server-1.18.1-20211210.034407-srg.jar%23143!/:?]
    ... 5 more
MarkusBordihn commented 2 years ago

Thanks a lot for the report. Should be fixed with https://www.curseforge.com/minecraft/mc-mods/player-companions/files/3723149 let me know if this works or if you still see the error.

DarkDinox commented 2 years ago

Hello Markus, thanks for your fast reply, we've had this issue again when a player hit to my companion(A rooster)

[21:10:07] [Server thread/ERROR]: Encountered an unexpected exception
net.minecraft.ReportedException: Ticking entity
    at net.minecraft.server.MinecraftServer.m_5703_(MinecraftServer.java:872) ~[server-1.18.1-20211210.034407-srg.jar%23142!/:?]
    at net.minecraft.server.dedicated.DedicatedServer.m_5703_(DedicatedServer.java:328) ~[server-1.18.1-20211210.034407-srg.jar%23142!/:?]
    at net.minecraft.server.MinecraftServer.m_5705_(MinecraftServer.java:808) ~[server-1.18.1-20211210.034407-srg.jar%23142!/:?]
    at net.minecraft.server.MinecraftServer.m_130011_(MinecraftServer.java:668) ~[server-1.18.1-20211210.034407-srg.jar%23142!/:?]
    at net.minecraft.server.MinecraftServer.m_177918_(MinecraftServer.java:258) ~[server-1.18.1-20211210.034407-srg.jar%23142!/:?]
    at java.lang.Thread.run(Thread.java:833) [?:?]
Caused by: java.lang.NullPointerException: Cannot invoke "String.isEmpty()" because "p_129298_" is null
    at net.minecraft.nbt.StringTag.m_129297_(StringTag.java:55) ~[server-1.18.1-20211210.034407-srg.jar%23142!/:?]
    at net.minecraft.nbt.CompoundTag.m_128359_(CompoundTag.java:200) ~[server-1.18.1-20211210.034407-srg.jar%23142!/:?]
    at de.markusbordihn.playercompanions.data.PlayerCompanionData.save(PlayerCompanionData.java:511) ~[player_companions_1.18.1-0.8.1.jar%23105!/:0.8.1]
    at de.markusbordihn.playercompanions.data.PlayerCompanionData.saveMetaData(PlayerCompanionData.java:457) ~[player_companions_1.18.1-0.8.1.jar%23105!/:0.8.1]
    at de.markusbordihn.playercompanions.data.PlayerCompanionsServerDataClientSync.exportPlayerCompanionData(PlayerCompanionsServerDataClientSync.java:69) ~[player_companions_1.18.1-0.8.1.jar%23105!/:0.8.1]
    at de.markusbordihn.playercompanions.data.PlayerCompanionsServerDataClientSync.syncPlayerCompanionData(PlayerCompanionsServerDataClientSync.java:42) ~[player_companions_1.18.1-0.8.1.jar%23105!/:0.8.1]
    at de.markusbordihn.playercompanions.data.PlayerCompanionsServerData.syncPlayerCompanionData(PlayerCompanionsServerData.java:297) ~[player_companions_1.18.1-0.8.1.jar%23105!/:0.8.1]
    at de.markusbordihn.playercompanions.data.PlayerCompanionsServerData.updatePlayerCompanion(PlayerCompanionsServerData.java:210) ~[player_companions_1.18.1-0.8.1.jar%23105!/:0.8.1]
    at de.markusbordihn.playercompanions.data.PlayerCompanionsServerData.updateOrRegisterCompanion(PlayerCompanionsServerData.java:177) ~[player_companions_1.18.1-0.8.1.jar%23105!/:0.8.1]
    at de.markusbordihn.playercompanions.data.PlayerCompanionsDataSync.syncData(PlayerCompanionsDataSync.java:44) ~[player_companions_1.18.1-0.8.1.jar%23105!/:0.8.1]
    at de.markusbordihn.playercompanions.data.PlayerCompanionsDataSync.syncData(PlayerCompanionsDataSync.java:21) ~[player_companions_1.18.1-0.8.1.jar%23105!/:0.8.1]
    at de.markusbordihn.playercompanions.data.PlayerCompanionsDataSync.syncDataIfNeeded(PlayerCompanionsDataSync.java:35) ~[player_companions_1.18.1-0.8.1.jar%23105!/:0.8.1]
    at de.markusbordihn.playercompanions.entity.PlayerCompanionEntityData.m_8119_(PlayerCompanionEntityData.java:635) ~[player_companions_1.18.1-0.8.1.jar%23105!/:0.8.1]
    at de.markusbordihn.playercompanions.entity.PlayerCompanionEntity.m_8119_(PlayerCompanionEntity.java:533) ~[player_companions_1.18.1-0.8.1.jar%23105!/:0.8.1]
    at de.markusbordihn.playercompanions.entity.type.guard.GuardEntityWalking.m_8119_(GuardEntityWalking.java:64) ~[player_companions_1.18.1-0.8.1.jar%23105!/:0.8.1]
    at net.minecraft.server.level.ServerLevel.m_8647_(ServerLevel.java:649) ~[server-1.18.1-20211210.034407-srg.jar%23142!/:?]
    at net.minecraft.world.level.Level.m_46653_(Level.java:487) ~[server-1.18.1-20211210.034407-srg.jar%23142!/:?]
    at net.minecraft.server.level.ServerLevel.m_184063_(ServerLevel.java:316) ~[server-1.18.1-20211210.034407-srg.jar%23142!/:?]
    at net.minecraft.world.level.entity.EntityTickList.m_156910_(EntityTickList.java:54) ~[server-1.18.1-20211210.034407-srg.jar%23142!/:?]
    at net.minecraft.server.level.ServerLevel.m_8793_(ServerLevel.java:296) ~[server-1.18.1-20211210.034407-srg.jar%23142!/:?]
    at net.minecraft.server.MinecraftServer.m_5703_(MinecraftServer.java:868) ~[server-1.18.1-20211210.034407-srg.jar%23142!/:?]
    ... 5 more
MarkusBordihn commented 2 years ago

Mhhh thanks for the update, this is strange. The part includes already a null check. Could you let me know which kind of Minecraft Forge version you are using?

At the moment it looks like that some of the errors happen because you are using and outdated version. I released a fix for the reported issue and add the requirement to use at least the latest stable version of Minecraft Forge.

I strongly recommending to update your server and client version to the latest version to avoid such issues / errors.

DarkDinox commented 2 years ago

Mhhh thanks for the update, this is strange. The part includes already a null check. Could you let me know which kind of Minecraft Forge version you are using?

At the moment it looks like that some of the errors happen because you are using and outdated version. I released a fix for the reported issue and add the requirement to use at least the latest stable version of Minecraft Forge.

I strongly recommending to update your server and client version to the latest version to avoid such issues / errors.

Hello, I'm using Forge 1.18.1-39.1.2 😥

MarkusBordihn commented 2 years ago

Thanks for the update, according your logs the Minecraft Server runs over the file server-1.18.1-20211210.034407-srg.jar which normally indicates that the version is from 2021-12-10 or so.

If you have still issues with an update to date client and server, I'm happy to take a closer look. I added some additional checks in the latest version with corrupt data files and will implement a backup in the next version.

Let me know if this fixes the issue, if not I need to know which kind of server you are running to see if I could reproduce the issue with running the same kind of server on my end.