I need help with NBT tags and entity dies trigger.

Started by CharlyMan on Sun, 08/21/2022 - 03:40

Topic category: Help with modding (Java Edition)

Last seen on 19:28, 19. Nov 2022
Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
I need help with NBT tags and entity dies trigger.
Sun, 08/21/2022 - 03:40

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 07:52, 21. Nov 2022
Joined Feb 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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 19:28, 19. Nov 2022
Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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 19:28, 19. Nov 2022
Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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.