This is a repost since I accidentally closed the last ticket. Working with MoreJS I want to make it so that villager trades are disabled unless their nbt 'memories: {hearts:#}' is equal to a specific value. For example, trades are disabed unless the merchants nbt is >= 'hearts: 25' I don't know how to get nbt values using KubeJS so if anyone can help, here's a base version of code I have so far:
MoreJSEvents.playerStartTrading(event => {
// check if the merchant given by the event is an instance of the AbstractVillager class
if (event.merchant instanceof $AbstractVillager) {
const { nbt } = event.merchant;
if (nbt?.memories?.hearts) {
// MoreJS event to disable trades
event.forEachOffers((o, i) => {
o.disabled = true;
});
}
}
});```