question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Fix villager suppot

See original GitHub issue

Versions

  • mineflayer: 2.12.0
  • server: LAN 1.8.8
  • node: v13.3.0

Detailed description of a problem

At first when I try to use bot.openVillager(villagerEntity) I get this error:

(node:10190) UnhandledPromiseRejectionWarning: AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
120 !== undefined
at Bot.openVillager (/dir/node_modules/mineflayer/lib/plugins/villager.js:56:12)

Which is easy to solve (villager in 1.8 has a capital letter), but lets just comment that assert for simplicity. The problem comes when I try to run the code without that assert and I get this error:

/dir/node_modules/minecraft-protocol/src/transforms/framing.js:67
          } else { throw e }
                   ^

Error: Read error for trades.3.firstInput.unknown.true.nbtData.type : 18 is not in the mappings value
    at ProtoDef.readMapper (/dir/node_modules/protodef/src/datatypes/utils.js:30:34)
    at ProtoDef.read (/dir/node_modules/protodef/src/protodef.js:36:25)
    at ProtoDef.read (/dir/node_modules/protodef/src/protodef.js:110:29)
    at /dir/node_modules/protodef/src/datatypes/structures.js:45:32
    at tryCatch (/dir/node_modules/protodef/src/utils.js:50:16)
    at tryDoc (/dir/node_modules/protodef/src/utils.js:54:10)
    at /dir/node_modules/protodef/src/datatypes/structures.js:44:5
    at Array.forEach (<anonymous>)
    at ProtoDef.readContainer (/dir/node_modules/protodef/src/datatypes/structures.js:43:12)
    at ProtoDef.read (/dir/node_modules/protodef/src/protodef.js:36:25) {
  field: 'trades.3.firstInput.unknown.true.nbtData.type'
}

I guess some changes broke backwards compatibility with 1.8 villagers.

Current code

let villager = bot.openVillager(villagerEntity)

Expected behavior

Shouldn’t throw error

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:13 (13 by maintainers)

github_iconTop GitHub Comments

1reaction
rom1504commented, May 9, 2020

ok got it,the openVillager callback was called wrong, fixed and released as 2.14.1

0reactions
rom1504commented, May 9, 2020

and why is village instance printed, is that related ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fixing Villager Trades & Ending Villager Exploitation for real ...
Strictly for humanoid and humanoid type mobs feedback and suggestions. Bugs, duplicate ideas, lists of things, and support issues will be ...
Read more >
Forge's Villager Trade Fix Mod? : r/feedthebeast - Reddit
I know that Fabric & Spigots has a trade fix mod to make Villager trades not broken anymore. But what about Forge?
Read more >
Villager Job Fix [DATA PACK] - Customization - CurseForge
Villager Job Fix [DATA PACK] ... Fix restocking issues;; Visually displays villagers that were able or unable to ... Support for my Data...
Read more >
Village mechanics - Minecraft Wiki - Fandom
Population of a village is never measured. Villager breeding succeeds if the birthing parent can path to an unclaimed bed with at least...
Read more >
Guide for Virtual Villagers Origins 2 - Story walkthrough
At Construction Level 2, you can also have your builders repair the Stone Hut at the top right of the map, closest to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found