Add Bulk enchantment operation interface.

This commit is contained in:
alexcrea 2024-07-11 14:02:05 +02:00
parent 0fd12b4185
commit d3252eecbd
No known key found for this signature in database
GPG key ID: 43FD265DB0DBF91F
6 changed files with 136 additions and 2 deletions

View file

@ -29,7 +29,6 @@ object ItemUtil {
fun ItemStack.setEnchantmentsUnsafe(enchantments: Map<CAEnchantment, Int>) {
CAEnchantment.clearEnchants(this)
//TODO maybe faster methode to add vanilla enchantment. maybe move this function to wrapped enchantment
enchantments.forEach { (enchantment, level) ->
enchantment.addEnchantmentUnsafe(this, level)
}

View file

@ -210,7 +210,7 @@ class EnchantConflictManager {
val newItem = item.clone()
CAEnchantment.clearEnchants(newItem)
enchantments.forEach{//TODO maybe bulk add if possible
enchantments.forEach{
enchantment -> enchantment.key.addEnchantmentUnsafe(newItem, enchantment.value)
}