diff --git a/build.gradle.kts b/build.gradle.kts index 0dacf7a..86662c2 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -37,7 +37,7 @@ allprojects { } dependencies { - compileOnly("com.willfp:eco:6.72.0") + compileOnly("com.willfp:eco:6.73.0") compileOnly("org.jetbrains:annotations:23.0.0") compileOnly("org.jetbrains.kotlin:kotlin-stdlib:1.9.20") compileOnly("com.github.ben-manes.caffeine:caffeine:3.1.5") diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoitems/EcoItemsPlugin.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoitems/EcoItemsPlugin.kt index ad87c47..30698b6 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoitems/EcoItemsPlugin.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoitems/EcoItemsPlugin.kt @@ -3,6 +3,7 @@ package com.willfp.ecoitems import com.willfp.eco.core.command.impl.PluginCommand import com.willfp.eco.core.display.DisplayModule import com.willfp.eco.core.items.Items +import com.willfp.eco.core.items.tag.CustomItemTag import com.willfp.ecoitems.commands.CommandEcoItems import com.willfp.ecoitems.display.ItemsDisplay import com.willfp.ecoitems.display.RarityDisplay @@ -11,6 +12,7 @@ import com.willfp.ecoitems.items.EcoItems import com.willfp.ecoitems.items.EcoItemsRecipes import com.willfp.ecoitems.items.ItemAttributeListener import com.willfp.ecoitems.items.ItemListener +import com.willfp.ecoitems.items.ecoItem import com.willfp.ecoitems.libreforge.ConditionHasEcoItem import com.willfp.ecoitems.rarity.ArgParserRarity import com.willfp.ecoitems.rarity.Rarities @@ -31,6 +33,9 @@ class EcoItemsPlugin : LibreforgePlugin() { override fun handleEnable() { Items.registerArgParser(ArgParserRarity) + Items.registerTag(CustomItemTag(this.createNamespacedKey("item")) { + it.ecoItem != null + }) Conditions.register(ConditionHasEcoItem) diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoitems/rarity/Rarity.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoitems/rarity/Rarity.kt index 280dec5..03eb51b 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoitems/rarity/Rarity.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoitems/rarity/Rarity.kt @@ -3,6 +3,7 @@ package com.willfp.ecoitems.rarity import com.willfp.eco.core.config.interfaces.Config import com.willfp.eco.core.display.Display import com.willfp.eco.core.items.Items +import com.willfp.eco.core.items.tag.CustomItemTag import com.willfp.eco.core.recipe.parts.EmptyTestableItem import com.willfp.eco.core.registry.KRegistrable import com.willfp.ecoitems.EcoItemsPlugin @@ -23,6 +24,14 @@ class Rarity( val displayLore = lore.map { Display.PREFIX + it } + val tag = CustomItemTag(plugin.createNamespacedKey(id)) { + it.ecoItemRarity == this + } + + init { + Items.registerTag(tag) + } + fun matches(item: ItemStack): Boolean { return items.any { it.matches(item) } }