1
0
mirror of https://github.com/chylex/Hardcore-Ender-Expansion-2.git synced 2025-04-11 03:15:44 +02:00

Add ItemStack.copyIf extension

This commit is contained in:
chylex 2018-11-04 12:26:58 +01:00
parent fe4b3c31c7
commit 309d671d04

View File

@ -12,6 +12,15 @@ inline var ItemStack.size: Int
inline val ItemStack.isNotEmpty
get() = !isEmpty
// Copy
inline fun ItemStack.copyIf(predicate: (ItemStack) -> Boolean): ItemStack{
return if (predicate(this))
this.copy()
else
this
}
// Enchantments
inline val ItemStack.enchantmentMap: Map<Enchantment, Int>