[Solved] Error creating items through custom Gui

Started by Hanseoa on

Topic category: Help with modding (Java Edition)

Last seen on 16:01, 3. Jun 2024
Joined May 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
[Solved] Error creating items through custom Gui
Mon, 01/15/2024 - 15:18 (edited)

Mcreator Version: 2023.4.51615

Minecraft Version: 1.20.1 Forge (47.2.0)

Plugins: Nothing.

Summary

In the multiplayer, press the button to create an item in the GUI to force it out of the server. 

with this message, Internal Exception: java.lang.NullPointerException: Cannot invoke "net.minecraft.nbt.CompoundTag.getDouble(String)" because "nbt" is null
 

https://drive.google.com/file/d/1ehFaGWG6bbl0gZjABblDcOVFpPc80ODv/view?usp=drive_link

https://drive.google.com/file/d/1HuMNi1JmvKgwL9GSURWPZexz10pLC7vf/view?usp=drive_link

 

Detail:

I make economy system. 

It works as follows.

1) Player (A) uses the card.
※ It is not a consumable item.

2) The GUI opens.
※ It looks like the following.

<Money : Player current money>
1000k 100k 10k
[button] [button] [button]
1k 100 10
[button] [button] [button]

3) Press [button] as many types as you want.

4) This amount will be reduced from the player's now and money items will be added.

5) Give the added money item to another player (B).

6) Player (B) uses the items received, and the money increases.

But Player(B) Problem occurs in number 3)

Player(B) press [Button] and force it out of the server, with this message 

Internal Exception: java.lang.NullPointerException: Cannot invoke "net.minecraft.nbt.CompoundTag.getDouble(String)" because "nbt" is null

Player(A) has no problem.

※ Player (A) is 'Client' for 'Run Server and Client' in 'Mcreator'

Reference:
https://mcreator.net/forum/93342/item-nbt-works-single-player-crashes-c…

https://mcreator.net/forum/84102/playerpersistant-doesnt-work-servers-properly

※ I couldn't solve the problem even after referring to the two posts.

※ Please let me know if you need photos in your feedback. I will post all the photos you need.

Edited by Hanseoa on Mon, 01/15/2024 - 15:18
Last seen on 16:01, 3. Jun 2024
Joined May 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Oh..Thank you for your…
Thu, 12/28/2023 - 15:36

Oh..Thank you for your response!
I just checked it out, Both a multiplayer server and a LAN server happen.

Is the 'PLAYER_PERSISTANT' global variable the cause?

 

 

That is very interesting …
Thu, 12/28/2023 - 15:53

That is very interesting (not in a good way). Would it be possible to isolate this problem to the minimal example workspace demonstrating this bug?

Last seen on 16:01, 3. Jun 2024
Joined May 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Oh, I am using a translator…
Thu, 12/28/2023 - 15:59

Oh, I am using a translator because I am not good at English.

Do you mean to create an example workspace that generates bugs?

Last seen on 16:01, 3. Jun 2024
Joined May 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Thank you Klemen for…
Sat, 12/30/2023 - 23:23

Thank you Klemen for response.

I hope there are good results. :)

Last seen on 16:01, 3. Jun 2024
Joined May 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I will find a version that…
Mon, 01/15/2024 - 13:30

I will find a version that works well in the snapshot version and upload it. I don't know if it will help... :)

Last seen on 16:01, 3. Jun 2024
Joined May 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Oh, never mind, I think I'm…
Mon, 01/15/2024 - 15:18

Oh, never mind, I think I'm mistaken. I'll close the post again.