mirror of
https://github.com/alexcrea/CustomAnvil.git
synced 2026-06-23 08:14:00 +02:00
get "all material" info from other plugins
This commit is contained in:
parent
459e3351fd
commit
41a62d810a
3 changed files with 35 additions and 0 deletions
|
|
@ -31,4 +31,8 @@ object EcoItemDependencyUtil {
|
||||||
return ecoi.itemStack
|
return ecoi.itemStack
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun getItems(): List<NamespacedKey> {
|
||||||
|
return EcoItems.values().map { item -> item.id }
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -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()
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue