Topic category: User side tutorials
How to get NBT data:
For this example, we're going to get the NBT data of the target/event entity. With a custom code snippet, put this inside:CompoundTag nbtdata = entity.saveWithoutId(new CompoundTag());
(If getting data from target entity, source entity or immediate source entity, make sure it is shown under "required dependencies")
To get the value of "HurtTime", use getShort since its a short-type number
nbtdata.getShort("HurtTime")
How to set NBT data:
To set the value of something (such as HurtTime), use this:nbtdata.putShort("HurtTime", 0);
and then load the new nbtdata onto the entity:entity.load(nbtdata);
If you want to get a list of values (such as ForgeData) within the nbtdata, you can use the following:CompoundTag forgedata = nbtdata.get("ForgeData")
I want to set a zombie's CanPickUpLoot data to be always true