mirror of
https://github.com/alexcrea/CustomAnvil.git
synced 2026-06-23 16:16:17 +02:00
Add Bulk enchantment operation interface.
This commit is contained in:
parent
0fd12b4185
commit
d3252eecbd
6 changed files with 136 additions and 2 deletions
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue