onEquip/onUnequip not run with Trinkets differentiated by Enchantment
fzzyhmstrs opened this issue ยท 0 comments
The oldStack -> newStack check in LivingEntity's tick
doesn't capture my trinkets being enchantment-driven. I have 3 common trinkets but 20-odd enchantments that can go on them that define their functionality.
if (!newStack.isItemEqual(oldStack)) {
TrinketsApi.getTrinket(oldStack.getItem()).onUnequip(oldStack, ref, entity);
TrinketsApi.getTrinket(newStack.getItem()).onEquip(newStack, ref, entity);
}
One headband/whatever looks like any other of that trinket according to this, but the enchantments may be different, and that's not captured/calling onEquip/onUnequip when you swap my trinkets because of this. you have to remove old trinket to inventory then equip new one to the empty slot.
This also may cause issues if some trinket, for example, had a durability associated with it. Any functionally-important NBT really.
ItemStack.areEqual(oldStack,newStack)
may resolve some of the issues mentioned.