Item with NBT works in single player, crashes client when obtained on server

Started by Lofty on

Topic category: Help with modding (Java Edition)

Last seen on 04:04, 3. Feb 2023
Joined Dec 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Item with NBT works in single player, crashes client when obtained on server

Hello friends,

I created an item with a GUI. 
The GUI sets an NBT text tag for the item.

In single player this works fine with no issues.
In multiplayer, the instant you craft the item (or select it from creative menu) the client immediately crashes with the following message:

Internal Exception: io.netty.handler.codec.DecoderException:
java.lang.NullPointerException: Cannot invoke "net.minecraft.nbt.CompoundTag.contains(String, int)" because "nbt" is null

Singleplayer:

Multiplayer:

Any help or advice would be appreciated.

 

Last seen on 07:34, 23. Apr 2024
Joined Mar 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
reason of this is that the…
Wed, 12/28/2022 - 01:58

reason of this is that the text it gets is well. an NULL text input

the in game crash report isn't enough

and would be better if an image of the procedures used is provided
but i guess is that you tried to get the nbt text with it being . NULL (basically empty)

so i recommend using the trigger when item on inventory tick add an 

IF (LOGIC NBT) = false
set (TEXT NBT) TO "Placeholder (anything that isn't a blank space)"
set (LOGIC NBT) TO true

Last seen on 04:04, 3. Feb 2023
Joined Dec 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Unbinding the GUI in item…
Wed, 12/28/2022 - 15:56

Unbinding the GUI in item properties fixed this issue.

I set the right click triggers (block and entity) to open the GUI instead.