mirror of
https://github.com/alexcrea/CustomAnvil.git
synced 2026-06-23 16:16:17 +02:00
Renamed WrappedEnchantment to CAEnchantment (CustomAnvilEnchantment).
created an interface out of CAEnchantment and moved the implementation to CAEnchantmentBase.
This commit is contained in:
parent
fa4752ea67
commit
dafe595c5b
20 changed files with 575 additions and 463 deletions
|
|
@ -3,7 +3,7 @@ package io.delilaheve.util
|
|||
import org.bukkit.Material.ENCHANTED_BOOK
|
||||
import org.bukkit.inventory.ItemStack
|
||||
import org.bukkit.inventory.meta.Damageable
|
||||
import xyz.alexcrea.cuanvil.enchant.WrappedEnchantment
|
||||
import xyz.alexcrea.cuanvil.enchant.CAEnchantment
|
||||
import kotlin.math.ceil
|
||||
import kotlin.math.max
|
||||
import kotlin.math.min
|
||||
|
|
@ -21,13 +21,13 @@ object ItemUtil {
|
|||
/**
|
||||
* Find the enchantment map for this [ItemStack] and return it as a [MutableMap]
|
||||
*/
|
||||
fun ItemStack.findEnchantments(): MutableMap<WrappedEnchantment, Int> = WrappedEnchantment.getEnchants(this)
|
||||
fun ItemStack.findEnchantments(): MutableMap<CAEnchantment, Int> = CAEnchantment.getEnchants(this)
|
||||
|
||||
/**
|
||||
* Apply an [enchantments] map to this [ItemStack]
|
||||
*/
|
||||
fun ItemStack.setEnchantmentsUnsafe(enchantments: Map<WrappedEnchantment, Int>) {
|
||||
WrappedEnchantment.clearEnchants(this)
|
||||
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) ->
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue