diff options
author | nea <nea@nea.moe> | 2023-09-06 02:35:06 +0200 |
---|---|---|
committer | nea <nea@nea.moe> | 2023-09-06 02:35:06 +0200 |
commit | 12292270511d5d37e9c21307fb1e09d400ae1ff4 (patch) | |
tree | 5ec91508b0b088f560c142291e1b1a9d7c281d21 | |
parent | d29f886e25d7376c6942e7dbe6c305f601e2768d (diff) | |
download | Firmament-12292270511d5d37e9c21307fb1e09d400ae1ff4.tar.gz Firmament-12292270511d5d37e9c21307fb1e09d400ae1ff4.tar.bz2 Firmament-12292270511d5d37e9c21307fb1e09d400ae1ff4.zip |
Add ability to remove item groupings
Item groups prevent batch rendering from being effective, thereby reducing performance.
4 files changed, 32 insertions, 16 deletions
diff --git a/src/main/kotlin/moe/nea/firmament/gui/config/ManagedConfig.kt b/src/main/kotlin/moe/nea/firmament/gui/config/ManagedConfig.kt index 8e05632..d2c4d69 100644 --- a/src/main/kotlin/moe/nea/firmament/gui/config/ManagedConfig.kt +++ b/src/main/kotlin/moe/nea/firmament/gui/config/ManagedConfig.kt @@ -158,6 +158,7 @@ abstract class ManagedConfig(override val name: String) : ManagedConfigElement() it.add(WButton(Text.literal("←")).also { it.setOnClick { if (parent != null) { + save() setScreenLater(parent) } else { AllConfigsGui.showAllGuis() @@ -182,6 +183,7 @@ abstract class ManagedConfig(override val name: String) : ManagedConfigElement() override fun close() { latestGuiAppender = null + save() MC.screen = parent } } diff --git a/src/main/kotlin/moe/nea/firmament/rei/FirmamentReiPlugin.kt b/src/main/kotlin/moe/nea/firmament/rei/FirmamentReiPlugin.kt index de743c6..a91cd71 100644 --- a/src/main/kotlin/moe/nea/firmament/rei/FirmamentReiPlugin.kt +++ b/src/main/kotlin/moe/nea/firmament/rei/FirmamentReiPlugin.kt @@ -18,11 +18,6 @@ import me.shedaniel.rei.api.client.registry.transfer.TransferHandlerRegistry 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.client.gui.screen.ingame.GenericContainerScreen -import net.minecraft.client.gui.screen.ingame.HandledScreen -import net.minecraft.item.ItemStack -import net.minecraft.text.Text -import net.minecraft.util.Identifier import moe.nea.firmament.events.HandledScreenPushREIEvent import moe.nea.firmament.features.inventory.CraftingOverlay import moe.nea.firmament.rei.recipes.SBCraftingRecipe @@ -31,6 +26,11 @@ import moe.nea.firmament.repo.RepoManager import moe.nea.firmament.util.SkyblockId import moe.nea.firmament.util.skyblockId import moe.nea.firmament.util.unformattedString +import net.minecraft.client.gui.screen.ingame.GenericContainerScreen +import net.minecraft.client.gui.screen.ingame.HandledScreen +import net.minecraft.item.ItemStack +import net.minecraft.text.Text +import net.minecraft.util.Identifier class FirmamentReiPlugin : REIClientPlugin { @@ -81,13 +81,14 @@ class FirmamentReiPlugin : REIClientPlugin { } 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(SkyblockId(it)) }) - } + if (!RepoManager.Config.disableItemGroups) + 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(SkyblockId(it)) }) + } } override fun registerScreens(registry: ScreenRegistry) { diff --git a/src/main/kotlin/moe/nea/firmament/repo/RepoManager.kt b/src/main/kotlin/moe/nea/firmament/repo/RepoManager.kt index 3059108..eda6130 100644 --- a/src/main/kotlin/moe/nea/firmament/repo/RepoManager.kt +++ b/src/main/kotlin/moe/nea/firmament/repo/RepoManager.kt @@ -13,11 +13,7 @@ import io.github.moulberry.repo.NEURepositoryException import io.github.moulberry.repo.data.NEUItem import io.github.moulberry.repo.data.NEURecipe import io.github.moulberry.repo.data.Rarity -import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents import kotlinx.coroutines.launch -import net.minecraft.client.MinecraftClient -import net.minecraft.network.packet.s2c.play.SynchronizeRecipesS2CPacket -import net.minecraft.text.Text import moe.nea.firmament.Firmament import moe.nea.firmament.Firmament.logger import moe.nea.firmament.gui.config.ManagedConfig @@ -25,6 +21,10 @@ import moe.nea.firmament.hud.ProgressBar import moe.nea.firmament.rei.PetData import moe.nea.firmament.util.MinecraftDispatcher import moe.nea.firmament.util.SkyblockId +import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents +import net.minecraft.client.MinecraftClient +import net.minecraft.network.packet.s2c.play.SynchronizeRecipesS2CPacket +import net.minecraft.text.Text object RepoManager { object Config : ManagedConfig("repo") { @@ -38,6 +38,16 @@ object RepoManager { branch = "prerelease" save() } + + val disableItemGroups by toggle("disable-item-groups") { false } + val reload by button("reload") { + save() + RepoManager.reload() + } + val redownload by button("redownload") { + save() + RepoManager.launchAsyncUpdate(true) + } } val currentDownloadedSha by RepoDownloadManager::latestSavedVersionHash diff --git a/src/main/resources/assets/firmament/lang/en_us.json b/src/main/resources/assets/firmament/lang/en_us.json index 5bb3fa1..380ea87 100644 --- a/src/main/resources/assets/firmament/lang/en_us.json +++ b/src/main/resources/assets/firmament/lang/en_us.json @@ -31,6 +31,9 @@ "firmament.config.repo.branch": "Repo Branch", "firmament.config.repo.branch.hint": "dangerous", "firmament.config.repo.reset": "Reset", + "firmament.config.repo.disable-item-groups": "Disable Item Groups", + "firmament.config.repo.reload": "Reload Item List", + "firmament.config.repo.redownload": "Redownload Item List", "firmament.ursa.debugrequest.start": "Ursa request launched", "firmament.ursa.debugrequest.result": "Ursa request succeeded: %s", "firmament.sbinfo.nolocraw": "No locraw data available", |