Integrated Dynamics

Integrated Dynamics

63M Downloads

Villager NBT (Offers) Incorrect

met4000 opened this issue ยท 9 comments

commented

Issue type:

  • ๐Ÿ› Bug

Short description:

NBT data of a villager produced by an Entity Reader is not entirely correct (specifically, the Offers; the rest of the data seems correct but has not been thoroughly tested). This is a problem with InDy, because /data returns NBT data that 'matches' the trades correctly.

Steps to reproduce the problem:

  1. Trap a villager.
  2. Give it a lectern (make it a librarian).
  3. Place an entity reader facing the villager, and make a card with the 'entity (element 0)' aspect.
  4. Use Entity NBT (NBT()) on the entity card.
  5. Place the NBT card into a display panel (and make the entity card available to the network).
  6. Inspect the Offers data of the NBT, e.g. by copy-pasting the nbt data out of the display panel into a text editor.

To use /data to inspect the Villager's NBT data:

  1. Look at the villager.
  2. Press / to start inputting a command.
  3. Type /data get entity .
  4. Press tab to autocomplete the entity's UUID (you must be looking exactly at the villager for this to work).
  5. Execute the command with enter.

(Sorry if these instructions are a bit too dumbed down/literal)

Expected behaviour:

The Offers NBT data from the Entity Reader matches the Offers NBT data of /data.


Versions:

mod version
MC 1.16.4
InTu 1.6.16
InTu Compat 1.6.16
Cyclops Core 1.11.1
Common Capabilities 2.5.5
Forge 35.1.4
InDy 1.4.3
InDy Compat 1.4.3
InNBT* 1.4.1
InCr 1.0.11
InTerm 1.1.1
InTerm Compat 1.1.1
InREST 1.1.2

(* I know InNBT isn't one of your mods)

Log file:

N/A

commented

Thanks for reporting!

commented

@met4000 What is the difference exactly?
I would be surprised if there's really any difference, as ID never really modifies NBT, unless configured via the config file.

commented

image
image

Note the different Enchanted Book enchant on the bottom line (prot 4, vs the actual punch 2).

InNBT and the villager GUI are easier to read; I can copy/paste from a display panel and get the /data output if you'd like to confirm.

commented

The NBT data also changes if you relog.
e.g.;
image

(feather falling 1 this time)

It's also not just that the enchantment is wrong; the entire trade selection itself can be different;
image

(the second trade is for a bookshelf this time, instead of even an enchanted book)

commented

Could you also share the full /data output?

commented

obraz
obraz

{Brain: {memories: {"minecraft:home": {value: {pos: [I; 115, 5, -323], dimension: "minecraft:overworld"}}, "minecraft:last_worked_at_poi": {value: 8970L}, "minecraft:job_site": {value: {pos: [I; 114, 5, -323], dimension: "minecraft:overworld"}}}}, HurtByTimestamp: 3185, Attributes: [{Base: 48.0d, Modifiers: [{Amount: 0.03632865932551174d, Operation: 1, UUID: [I; 1096226585, 712394031, -1842438113, -610061313], Name: "Random spawn bonus"}], Name: "minecraft:generic.follow_range"}, {Base: 0.5d, Name: "minecraft:generic.movement_speed"}, {Base: 0.08d, Name: "forge:entity_gravity"}], FoodLevel: 0b, Invulnerable: 0b, FallFlying: 0b, ForcedAge: 0, Gossips: [{Target: [I; -630066101, -294630296, -1712175405, 1385217745], Type: "minor_negative", Value: 50}], PortalCooldown: 0, AbsorptionAmount: 0.0f, LastRestock: 0L, FallDistance: 0.0f, CanUpdate: 1b, DeathTime: 0s, Xp: 0, LastGossipDecay: 3308L, HandDropChances: [0.085f, 0.085f], PersistenceRequired: 0b, UUID: [I; -1951615447, -2069348014, -1905820949, -547293297], Age: 0, Motion: [0.0d, -0.0784000015258789d, 0.0d], Health: 18.0f, LeftHanded: 0b, Air: 300s, OnGround: 1b, Offers: {Recipes: [{maxUses: 16, buyB: {id: "minecraft:air", Count: 1b}, buy: {id: "minecraft:paper", Count: 24b}, sell: {id: "minecraft:emerald", Count: 1b}, xp: 2, uses: 0, priceMultiplier: 0.05f, specialPrice: 0, demand: 0, rewardExp: 1b}, {maxUses: 12, buyB: {id: "minecraft:book", Count: 1b}, buy: {id: "minecraft:emerald", Count: 11b}, sell: {id: "minecraft:enchanted_book", Count: 1b, tag: {StoredEnchantments: [{lvl: 1s, id: "minecraft:loyalty"}]}}, xp: 1, uses: 0, priceMultiplier: 0.2f, specialPrice: 0, demand: 0, rewardExp: 1b}]}, Rotation: [40.132385f, 0.0f], HandItems: [{}, {}], RestocksToday: 0, ArmorDropChances: [0.085f, 0.085f, 0.085f, 0.085f], Pos: [115.6999999880791d, 5.0d, -322.6454972398964d], Fire: -1s, ArmorItems: [{}, {}, {}, {}], CanPickUpLoot: 1b, VillagerData: {profession: "minecraft:librarian", level: 1, type: "minecraft:plains"}, HurtTime: 0s, Inventory: []}

Will this do? This time according to InDy librarian doesn't sell anything despite the fact that in /data we have tag 'Offers'

commented

I also did a test (because I was worried that it was IntegratedNBT causing the problem):

Here is the result from copying the value in display panel:

{Brain:{memories:{}},HurtByTimestamp:0,Attributes:[{Base:0.08d,Name:"forge:entity_gravity"},{Base:0.5d,Name:"minecraft:generic.movement_speed"}],FoodLevel:0b,Invulnerable:0b,FallFlying:0b,ForcedAge:0,Gossips:[],PortalCooldown:0,AbsorptionAmount:0.0f,LastRestock:0L,FallDistance:0.0f,CanUpdate:1b,DeathTime:0s,Xp:0,LastGossipDecay:3622L,HandDropChances:[0.085f,0.085f],PersistenceRequired:0b,id:"minecraft:villager",UUID:[I;-251716197,-1985855257,-1495943295,-17607430],Age:1,Motion:[0.0d,0.0d,0.0d],Health:20.0f,LeftHanded:0b,Air:300s,OnGround:1b,Offers:{Recipes:[{maxUses:12,buyB:{id:"minecraft:book",Count:1b},buy:{id:"minecraft:emerald",Count:13b},sell:{id:"minecraft:enchanted_book",Count:1b,tag:{StoredEnchantments:[{lvl:2s,id:"minecraft:fire_aspect"}]}},xp:1,uses:0,priceMultiplier:0.2f,specialPrice:0,demand:0,rewardExp:1b},{maxUses:12,buyB:{id:"minecraft:air",Count:1b},buy:{id:"minecraft:emerald",Count:9b},sell:{id:"minecraft:bookshelf",Count:1b},xp:1,uses:0,priceMultiplier:0.05f,specialPrice:0,demand:0,rewardExp:1b}]},Rotation:[45.0f,0.0f],HandItems:[{},{}],RestocksToday:0,ArmorDropChances:[0.085f,0.085f,0.085f,0.085f],Pos:[-237.41752810201024d,4.0d,209.41752810201024d],Fire:0s,ArmorItems:[{},{},{},{}],CanPickUpLoot:1b,VillagerData:{profession:"minecraft:librarian",level:1,type:"minecraft:plains"},HurtTime:0s,Inventory:[]}

And here is the result from running the /data command:

{Brain: {memories: {"minecraft:meeting_point": {value: {pos: [I; -235, 6, 233], dimension: "minecraft:overworld"}}, "minecraft:home": {value: {pos: [I; -281, 5, 236], dimension: "minecraft:overworld"}}, "minecraft:last_slept": {value: 12383L}, "minecraft:last_woken": {value: 21L}, "minecraft:last_worked_at_poi": {value: 8731L}, "minecraft:job_site": {value: {pos: [I; -271, 5, 238], dimension: "minecraft:overworld"}}}}, HurtByTimestamp: 0, Attributes: [{Base: 48.0d, Modifiers: [{Amount: -0.002111317381314879d, Operation: 1, UUID: [I; -2068933298, -1603253150, -1286575801, 797868335], Name: "Random spawn bonus"}], Name: "minecraft:generic.follow_range"}, {Base: 0.08d, Name: "forge:entity_gravity"}, {Base: 0.5d, Name: "minecraft:generic.movement_speed"}], FoodLevel: 0b, Invulnerable: 0b, FallFlying: 0b, ForcedAge: 0, Gossips: [], PortalCooldown: 0, AbsorptionAmount: 0.0f, LastRestock: 0L, FallDistance: 0.0f, CanUpdate: 1b, SleepingX: -281, DeathTime: 0s, SleepingZ: 236, SleepingY: 5, Xp: 0, LastGossipDecay: 1L, HandDropChances: [0.085f, 0.085f], PersistenceRequired: 0b, UUID: [I; -1629141741, -2003481234, -1370577847, -2088142001], Age: 0, Motion: [0.0d, -0.04760748099525583d, 0.0d], Health: 20.0f, LeftHanded: 0b, Air: 300s, OnGround: 1b, Offers: {Recipes: [{maxUses: 16, buyB: {id: "minecraft:air", Count: 1b}, buy: {id: "minecraft:rotten_flesh", Count: 32b}, sell: {id: "minecraft:emerald", Count: 1b}, xp: 2, uses: 0, priceMultiplier: 0.05f, specialPrice: 0, demand: 0, rewardExp: 1b}, {maxUses: 12, buyB: {id: "minecraft:air", Count: 1b}, buy: {id: "minecraft:emerald", Count: 1b}, sell: {id: "minecraft:redstone", Count: 2b}, xp: 1, uses: 0, priceMultiplier: 0.05f, specialPrice: 0, demand: 0, rewardExp: 1b}]}, Rotation: [223.18591f, 0.0f], HandItems: [{}, {}], RestocksToday: 0, ArmorDropChances: [0.085f, 0.085f, 0.085f, 0.085f], Pos: [-280.37051901855506d, 5.5625d, 236.36202877780747d], Fire: -1s, ArmorItems: [{}, {}, {}, {}], CanPickUpLoot: 1b, VillagerData: {profession: "minecraft:cleric", level: 1, type: "minecraft:plains"}, HurtTime: 0s, Inventory: []}

As you can see, they are indeed different.

I also checked the code a bit, but I wasn't able to spot the issue.

commented

It looks as though the trades are generated as though on a 'new'/'different' villager. A guess could be that the entity reference card instead references a 'new' villager, and copies over the data except for trades (hence new ones are generated).

commented

(misclick)