start new system with unit repair

This commit is contained in:
alexcrea 2024-02-07 14:45:01 +01:00
parent f51240adc6
commit 77c34e029f
7 changed files with 111 additions and 41 deletions

View file

@ -25,13 +25,6 @@ object ItemUtil {
*/
private fun ItemStack.isEnchantedBook() = type == ENCHANTED_BOOK
/**
* Determine if this [ItemStack] can hold enchants, this should be sufficient for
* detecting if an item is a tool/armour/etc... and not a carrot/potato/etc...
*/
private fun ItemStack.canHoldEnchants() = Enchantment.values()
.any { it.canEnchantItem(this) }
/**
* Find the enchantment map for this [ItemStack] and return it as a [MutableMap]
*/
@ -108,5 +101,5 @@ object ItemUtil {
*/
fun ItemStack.canMergeWith(
other: ItemStack
) = type == other.type || (canHoldEnchants() && other.isEnchantedBook())
) = type == other.type || (other.isEnchantedBook())
}