Include offhand inventory in imbued item updating (and armour, while we're at it), fixes #493

This commit is contained in:
Electroblob77
2020-12-20 23:32:12 +00:00
parent 58f6d55b0d
commit e19d324dca
@@ -346,6 +346,21 @@ public class WizardData implements INBTSerializable<NBTTagCompound> {
// For each item in the player's inventory // For each item in the player's inventory
for(ItemStack stack : player.inventory.mainInventory){ for(ItemStack stack : player.inventory.mainInventory){
updateImbutedItem(stack, activeImbuements);
}
for(ItemStack stack : player.inventory.armorInventory){
updateImbutedItem(stack, activeImbuements);
}
for(ItemStack stack : player.inventory.offHandInventory){
updateImbutedItem(stack, activeImbuements);
}
// Removes all imbuements from the map that are no longer active
this.imbuementDurations.keySet().retainAll(activeImbuements);
}
private void updateImbutedItem(ItemStack stack, Set<Imbuement> activeImbuements){
if(stack.isItemEnchanted()){ if(stack.isItemEnchanted()){
NBTTagList enchantmentList = stack.getItem() == Items.ENCHANTED_BOOK ? NBTTagList enchantmentList = stack.getItem() == Items.ENCHANTED_BOOK ?
@@ -373,9 +388,6 @@ public class WizardData implements INBTSerializable<NBTTagCompound> {
} }
} }
} }
// Removes all imbuements from the map that are no longer active
this.imbuementDurations.keySet().retainAll(activeImbuements);
}
// Ally designation system // Ally designation system