#how to edit player nbt
28 messages · Page 1 of 1 (latest)
Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!
You can use an entity tick event
Get the entity from the event
Check if it's a player
Return if not
Get nbt
With .nbt
Then modify it
How do you modify it
Look at what it returns
By logging it
The use that as reference of how to modify it
ServerEvents.tick(e => {
const { server } = e
if(server.tickCount % 20) return
server.entities.filterSelector('@e[type=minecraft:player]').forEach(player => {
console.log(player.foodData.saturation)
})
}) ```
I confunded myself twice
can you not just use a player tick event
broh, you're a genius
PlayerEvents.tick(e => {
const { player, level, server } = e
if(server.tickCount % 20) return
console.log(player.foodData.saturation)
})```
you can use the set methods to change the values, like setSaturation for example
so how does player.foodData.saturation connect to the level
it's this the level.dat file? you can look at the wiki to understand that https://minecraft.wiki/w/Hunger
that the player nbt data seen through ftb library nbtedit player {username) you can manually edit your nbt values and see them
this does show player.foodlevel
its marked as an interger
next goal is to just detect the change
figured it out thank you
player.foodData.foodLevel is what i needed
now i can freely edit it
it works thank you!