diff options
author | nea <nea@nea.moe> | 2023-05-04 15:54:56 +0200 |
---|---|---|
committer | nea <nea@nea.moe> | 2023-05-04 15:54:56 +0200 |
commit | 60ecfedf46e94344e6439a3a90c4c74ee65eeb2e (patch) | |
tree | 3bbc081ea1de971d343f438f12707909925d42fe /src/main/kotlin/moe/nea/notenoughupdates/rei | |
parent | 4053a2995e845b48fdaf584f7a6787cd1e4dd4bc (diff) | |
download | Firmament-60ecfedf46e94344e6439a3a90c4c74ee65eeb2e.tar.gz Firmament-60ecfedf46e94344e6439a3a90c4c74ee65eeb2e.tar.bz2 Firmament-60ecfedf46e94344e6439a3a90c4c74ee65eeb2e.zip |
Add parents to collapisble entries
Diffstat (limited to 'src/main/kotlin/moe/nea/notenoughupdates/rei')
-rw-r--r-- | src/main/kotlin/moe/nea/notenoughupdates/rei/NEUReiPlugin.kt | 14 | ||||
-rw-r--r-- | src/main/kotlin/moe/nea/notenoughupdates/rei/SBItemEntryDefinition.kt | 2 |
2 files changed, 15 insertions, 1 deletions
diff --git a/src/main/kotlin/moe/nea/notenoughupdates/rei/NEUReiPlugin.kt b/src/main/kotlin/moe/nea/notenoughupdates/rei/NEUReiPlugin.kt index 88f7abc..de515f3 100644 --- a/src/main/kotlin/moe/nea/notenoughupdates/rei/NEUReiPlugin.kt +++ b/src/main/kotlin/moe/nea/notenoughupdates/rei/NEUReiPlugin.kt @@ -2,16 +2,18 @@ package moe.nea.notenoughupdates.rei import io.github.moulberry.repo.data.NEUItem import me.shedaniel.rei.api.client.plugins.REIClientPlugin +import me.shedaniel.rei.api.client.registry.entry.CollapsibleEntryRegistry import me.shedaniel.rei.api.client.registry.entry.EntryRegistry import me.shedaniel.rei.api.client.registry.screen.ScreenRegistry import me.shedaniel.rei.api.common.entry.EntryStack import me.shedaniel.rei.api.common.entry.type.EntryTypeRegistry import me.shedaniel.rei.api.common.entry.type.VanillaEntryTypes import net.minecraft.item.ItemStack +import net.minecraft.text.Text import net.minecraft.util.Identifier -import moe.nea.notenoughupdates.repo.ItemCache import moe.nea.notenoughupdates.repo.ItemCache.asItemStack import moe.nea.notenoughupdates.repo.RepoManager +import moe.nea.notenoughupdates.util.SkyblockId class NEUReiPlugin : REIClientPlugin { @@ -28,6 +30,16 @@ class NEUReiPlugin : REIClientPlugin { registry.register(SKYBLOCK_ITEM_TYPE_ID, SBItemEntryDefinition) } + override fun registerCollapsibleEntries(registry: CollapsibleEntryRegistry) { + RepoManager.neuRepo.constants.parents.parents + .forEach { (parent, children) -> + registry.group( + SkyblockId(parent).identifier, + Text.literal(RepoManager.getNEUItem(SkyblockId(parent))?.displayName ?: parent), + (children + parent).map { SBItemEntryDefinition.getEntry(RepoManager.getNEUItem(SkyblockId(it))) }) + } + } + override fun registerScreens(registry: ScreenRegistry) { registry.registerFocusedStack(SkyblockItemIdFocusedStackProvider) } diff --git a/src/main/kotlin/moe/nea/notenoughupdates/rei/SBItemEntryDefinition.kt b/src/main/kotlin/moe/nea/notenoughupdates/rei/SBItemEntryDefinition.kt index a9d4a7c..90d5931 100644 --- a/src/main/kotlin/moe/nea/notenoughupdates/rei/SBItemEntryDefinition.kt +++ b/src/main/kotlin/moe/nea/notenoughupdates/rei/SBItemEntryDefinition.kt @@ -68,5 +68,7 @@ object SBItemEntryDefinition : EntryDefinition<NEUItem> { return value?.getIdentifier() ?: Identifier.of("skyblockitem", "null")!! } + fun getEntry(neuItem: NEUItem?) = EntryStack.of(this, neuItem) + } |