I need help with NBT tags and entity dies trigger.

Started by CharlyMan on

Topic category: Help with modding (Java Edition)

Last seen on 04:08, 14. Dec 2022
Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I need help with NBT tags and entity dies trigger.

I need help with a couple of things.

1. NBT tags won’t stay on a player when they leave the world and/or die. If you know how to keep NBT tags on players when they leave the world or die please tell me.

2. I am using the entity dies global trigger so when the player kills an entity it increases an NBT tag by 100, but it doesn’t work (I checked for both Source Entity and Event/Target Entity). If you could fix this to please tell me.

Have a good day!

Last seen on 06:22, 13. Mar 2023
Joined Feb 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
1) So you need to decide…
Mon, 08/22/2022 - 04:16

1) So you need to decide whether to us player nbt tags or player variables. The variable page explains this, but from my understanding, nbt tags are loaded server side, and player variables are loaded client side. In addition, if i want someone to have easier access to my nbt data i leave it as an nbt tag or if i dont i use a player variable, as nbt tags can be set across different mods. That being said, player variables aren’t removed on death. So if you want to use an nbt tag that will pass on death you can either use a player variable instead depending on what you need, or for nbt data tags, on death set the nbt tag to a player variable, and then on respawn set the nbt tag to that variable, and that variable to nothing. This allows for the player to exit the game even and then respawn and it will still work.

2) That should work fine for the source entity as the source entity would be the player. Can you add a snippet of your code?

Last seen on 04:08, 14. Dec 2022
Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
For the second one, I did go…
Fri, 09/02/2022 - 05:20

For the second one, I did go over the code with a person who knows the Java coding language, and we both didn’t understand it. Also, thank you so much for telling me about player variables, these would be very useful for many of my mods.

Last seen on 04:08, 14. Dec 2022
Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Very late response but, Yes,…
Mon, 09/19/2022 - 00:24

Very late response but, Yes, the player variable were very useful for one of my mods. Also, I made a smelting procedure that accepts NBT as fuel.

Last seen on 04:46, 14. Mar 2024
Joined Nov 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
im trying for 3 days now to…
Mon, 12/04/2023 - 10:26

im trying for 3 days now to store NBT or Global Vars for a simple number: Player Cash Amount, no luck, every time i exit and load the world again the value is reset to 0