mirror of
https://github.com/alexcrea/CustomAnvil.git
synced 2026-06-24 00:26:16 +02:00
start new system with unit repair
This commit is contained in:
parent
f51240adc6
commit
77c34e029f
7 changed files with 111 additions and 41 deletions
|
|
@ -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())
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue