Closed zomabies closed 1 year ago
Looks good, what is the purpose of storing the location of the villagers? Is it only for the info messages?
Thanks.
what is the purpose of storing the location of the villagers? Is it only for the info messages?
Currently, villager requires "right-hand" interaction to get trade list (similar to block entities with inventory). When disconnected/leaving chunk and villager get unloaded, and reloaded again (rejoin/re-enter chunk), it fetches the server version without trade list.
In this case, player need to perform interaction again to save the trades. It can become tedious when do not know if the trades is successfully saved unless search the relevant trades with NBT editor. Therefore, I handled it by storing the villager UUID and trades in a Map
, similar to ContainerManager
for handling block entities load/unload.
I not sure this is the best practice since entity with inventories do need such handling, it work on villager though.
This PR aims to fix villager trades saving as shown in #554.
Additionally
ContainerManager
) to prevent it being overwritten when re-joining.Tested in 1.19.4