get "all material" info from other plugins

This commit is contained in:
alexcrea 2026-04-23 12:22:40 +02:00
parent 459e3351fd
commit 41a62d810a
Signed by: alexcrea
GPG key ID: E346CD16413450E3
3 changed files with 35 additions and 0 deletions

View file

@ -31,4 +31,8 @@ object EcoItemDependencyUtil {
return ecoi.itemStack return ecoi.itemStack
} }
fun getItems(): List<NamespacedKey> {
return EcoItems.values().map { item -> item.id }
}
} }

View file

@ -35,4 +35,8 @@ class ItemsAdderDependency(plugin: Plugin) : GenericPluginDependency(plugin) {
return NamespacedKey.fromString(customItem.namespacedID) return NamespacedKey.fromString(customItem.namespacedID)
} }
fun idsCount(): Set<String> {
return CustomStack.getNamespacedIdsInRegistry()
}
} }

View file

@ -76,5 +76,32 @@ object MaterialUtil {
return getMatFromKey(key) != null return getMatFromKey(key) != null
} }
fun getMaterialCount(): Int {
var count = Material.entries.size
if(HasEcoItem) {
count += EcoItemDependencyUtil.getItems().size
}
val itemAdder = DependencyManager.itemsAdderCompatibility
if(itemAdder != null) {
count += itemAdder.idsCount().size
}
return count
}
fun getMaterials(): MutableList<NamespacedKey> {
val all = ArrayList(Material.entries.map { it.key })
if(HasEcoItem) {
all.addAll(EcoItemDependencyUtil.getItems())
}
val itemAdder = DependencyManager.itemsAdderCompatibility
if(itemAdder != null) {
all.addAll(itemAdder.idsCount().map { NamespacedKey.fromString(it) })
}
return all
}
} }