mirror of
https://github.com/Auxilor/EcoEnchants.git
synced 2024-11-21 14:55:17 +01:00
Reimplemented %active_level%
This commit is contained in:
parent
35564c6891
commit
762ff2524f
@ -16,6 +16,7 @@ import com.willfp.ecoenchants.display.EnchantSorter
|
||||
import com.willfp.ecoenchants.enchants.EcoEnchantLevel
|
||||
import com.willfp.ecoenchants.enchants.EcoEnchants
|
||||
import com.willfp.ecoenchants.enchants.EnchantGUI
|
||||
import com.willfp.ecoenchants.enchants.FoundEcoEnchantLevel
|
||||
import com.willfp.ecoenchants.enchants.LoreConversion
|
||||
import com.willfp.ecoenchants.enchants.registerVanillaEnchants
|
||||
import com.willfp.ecoenchants.integrations.EnchantRegistrations
|
||||
@ -62,10 +63,10 @@ class EcoEnchantsPlugin : LibreforgePlugin() {
|
||||
override fun handleEnable() {
|
||||
registerHolderProvider { it.heldEnchantLevels }
|
||||
registerPlayerRefreshFunction { it.clearEnchantCache() }
|
||||
registerHolderPlaceholderProvider<EcoEnchantLevel> { it, player ->
|
||||
registerHolderPlaceholderProvider<FoundEcoEnchantLevel> { it, _ ->
|
||||
listOf(
|
||||
NamedValue("level", it.level),
|
||||
//NamedValue("active_level", player.getActiveEnchantLevel(it.enchant))
|
||||
NamedValue("active_level", it.activeLevel)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -31,3 +31,12 @@ class EcoEnchantLevel(
|
||||
return Objects.hash(this.id)
|
||||
}
|
||||
}
|
||||
|
||||
data class FoundEcoEnchantLevel(
|
||||
val level: EcoEnchantLevel,
|
||||
val activeLevel: Int
|
||||
): Holder {
|
||||
override val effects = level.effects
|
||||
override val conditions = level.conditions
|
||||
override val id = level.id
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import com.willfp.eco.core.fast.fast
|
||||
import com.willfp.eco.core.items.HashedItem
|
||||
import com.willfp.ecoenchants.enchants.EcoEnchant
|
||||
import com.willfp.ecoenchants.enchants.EcoEnchantLevel
|
||||
import com.willfp.ecoenchants.enchants.FoundEcoEnchantLevel
|
||||
import com.willfp.ecoenchants.target.EnchantLookup.getEnchantLevel
|
||||
import com.willfp.libreforge.ItemProvidedHolder
|
||||
import com.willfp.libreforge.ProvidedHolder
|
||||
@ -304,7 +305,14 @@ object EnchantLookup {
|
||||
}
|
||||
}
|
||||
|
||||
return found
|
||||
return found.map {
|
||||
val level = it.holder as EcoEnchantLevel
|
||||
|
||||
ItemProvidedHolder(
|
||||
FoundEcoEnchantLevel(level, this.getActiveEnchantLevel(level.enchant)),
|
||||
it.provider
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user