Minescript

Minescript

391 Downloads

Entity NBT Data not displaying correctly

hub-sdaft opened this issue ยท 0 comments

commented

Mod Version: Fabric v3.1
MC Version: 1.19.4
Issue:
This is a very specific issue regarding entities' NBT data on the Fabric version of the mod.

I tried obtaining the "Xp" field from a zombie villager with whom I traded before zombifying it, but the value was always 0 regardless.

The "Xp" field in a villager describes its experience, levelled up through trading. When a villager is zombified, the "Xp" field is inherited from the pre-existing villager.

How to reproduce

In Minecraft:

  • Trade with a villager of any profession at least once (increasing its Xp value)
  • Zombify it
  • Execute the following script, in the vicinity of the zombie villager:
    import minescript
    for entity in minescript.entities(nbt=True):
        if entity.get("type") == "entity.minecraft.zombie_villager":
            minescript.echo(entity.get("nbt")

Result obtained

In the minecraft chat:
{AbsorptionAmount:0.0f,...,Xp:0}

Note that the Xp value is still 0, even after trading with the villager

(Complete data using a cartographer)
{AbsorptionAmount:0.0f,Air:300s,ArmorDropChances:[0.085f,0.085f,0.085f,0.085f],ArmorItems:[{},{},{},{}],Attributes:[{Base:0.23000000417232513d,Name:"minecraft:generic.movement_speed"}],Brain:{memories:{}},CanBreakDoors:0b,CanPickUpLoot:0b,ConversionTime:-1,DeathTime:0s,DrownedConversionTime:-1,FallDistance:0.0f,FallFlying:0b,Fire:0s,HandDropChances:[0.085f,0.085f],HandItems:[{},{}],Health:20.0f,HurtByTimestamp:0,HurtTime:0s,InWaterTime:-1,Invulnerable:0b,IsBaby:0b,LeftHanded:0b,Motion:[0.0d,0.0d,0.0d],OnGround:1b,PersistenceRequired:0b,PortalCooldown:0,Pos:[0.236083984375d,-60.0d,3.5263671875d],Rotation:[-94.21875f,0.0f],UUID:[I;-1343181064,-1069531105,-1175001995,1052266193],VillagerData:{level:1,profession:"minecraft:cartographer",type:"minecraft:plains"},Xp:0}

Result expected

In the minecraft chat: {AbsorptionAmount:0.0f,...,Xp:2}
The Xp value should be greater than 0.

The correct value can be verified using the following vanilla command:
/data get entity [zombie_villager_uuid] Xp, which would output Zombie Villager has following entity data: 2