Started by
CharlyMan
on
Topic category: Help with Minecraft modding (Java Edition)
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!
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?
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.
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.
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