AlmostReliable / morejs

A Minecraft mod to extend KubeJS with additional events.
https://www.curseforge.com/minecraft/mc-mods/morejs
GNU Lesser General Public License v3.0
11 stars 1 forks source link

Game crash when interacting with villager #6

Open Treeways opened 1 year ago

Treeways commented 1 year ago

Version

0.0.7

Describe the bug!

When spawning a new modified villager, right clicking the villager will crash the game due to a null error. (I'm using a command block setup to test.) It happens pretty randomly... It might be because of a recipe in my code, but I'm not sure.

When rejoining the same world, everything will load fine, but the villager which crashed the game will still do so if interacted with.

For further context: currently I'm iterating through a complicated JS object filled with trades, and using Object.keys to traverse and add recipes dynamically based on that object. I have no KubeJS errors - my data and loop is valid. Here is a gist with the code I'm using: https://gist.github.com/Treeway7/fe9902eb0761bd0692528f8c7b80ab8f

EDIT: I'm now noticing that some villagers don't let you access their trades at all... Probably because, well, nothing was even generated. I'm pretty sure the game crashes if you spam the villager too much, or maybe just too early, as the game tries to generate villager recipes. But I might be wrong about this.

Here is a gist of that error, which happened as the villager was spawned: https://gist.github.com/Treeway7/9353a989c15263ccdabf6035f5de1c13

However, killing and replacing that villager does not reproduce the issue... It doesn't seem consistent, at least.

Speaking of this, here is my command block setup to reset trades:

kill @e[type=minecraft:villager]
repeater (max delay)
repeater (max delay)
summon minecraft:villager 1723.50 90 -1338.5
redstone wire
repeater (min delay)
redstone wire
clear @p
repeater (min delay)
give (username) minecraft:emerald 256

Also, please note that KubeJS runs /reload for me a second time every time the world starts, 48 ticks after it loads. I'm not sure if that messes with anything from this addon.

Crash Report

https://gist.github.com/Treeway7/c99b152b39815a84dbf3f774a1655bee

Log

https://gist.github.com/Treeway7/b60ea91ca61b5ad28f68b9d7ca4b1d1e

Additional Context

Yes

Modifications

There's a whole bunch of other mods, namely Apotheosis which messes with some of the enchanting trades, but I haven't touched librarian trades.

I modified the Armorer recipes (all levels) and recipes from the Shepherd (master only).

Did the issue happen in singleplayer or on a server?

Singleplayer