diff options
10 files changed, 66 insertions, 29 deletions
diff --git a/src/compat/rei/java/moe/nea/firmament/compat/rei/FirmamentReiCommonPlugin.kt b/src/compat/rei/java/moe/nea/firmament/compat/rei/FirmamentReiCommonPlugin.kt index 98ac276..71e867a 100644 --- a/src/compat/rei/java/moe/nea/firmament/compat/rei/FirmamentReiCommonPlugin.kt +++ b/src/compat/rei/java/moe/nea/firmament/compat/rei/FirmamentReiCommonPlugin.kt @@ -2,9 +2,11 @@ package moe.nea.firmament.compat.rei import me.shedaniel.rei.api.common.entry.type.EntryTypeRegistry import me.shedaniel.rei.api.common.plugins.REICommonPlugin +import moe.nea.firmament.repo.RepoManager class FirmamentReiCommonPlugin : REICommonPlugin { override fun registerEntryTypes(registry: EntryTypeRegistry) { + if (!RepoManager.shouldLoadREI()) return registry.register(FirmamentReiPlugin.SKYBLOCK_ITEM_TYPE_ID, SBItemEntryDefinition) } } diff --git a/src/compat/rei/java/moe/nea/firmament/compat/rei/FirmamentReiPlugin.kt b/src/compat/rei/java/moe/nea/firmament/compat/rei/FirmamentReiPlugin.kt index 89c3e19..3a494b9 100644 --- a/src/compat/rei/java/moe/nea/firmament/compat/rei/FirmamentReiPlugin.kt +++ b/src/compat/rei/java/moe/nea/firmament/compat/rei/FirmamentReiPlugin.kt @@ -55,6 +55,7 @@ class FirmamentReiPlugin : REIClientPlugin { @OptIn(ExpensiveItemCacheApi::class) override fun registerTransferHandlers(registry: TransferHandlerRegistry) { + if (!RepoManager.shouldLoadREI()) return registry.register(TransferHandler { context -> val screen = context.containerScreen val display = context.display @@ -64,8 +65,11 @@ class FirmamentReiPlugin : REIClientPlugin { val neuItem = RepoManager.getNEUItem(SkyblockId(recipe.output.itemId)) ?: error("Could not find neu item ${recipe.output.itemId} which is used in a recipe output") val useSuperCraft = context.isStackedCrafting || RepoManager.Config.alwaysSuperCraft - if (neuItem.isVanilla && useSuperCraft) return@TransferHandler TransferHandler.Result.createFailed(Text.translatable( - "firmament.recipe.novanilla")) + if (neuItem.isVanilla && useSuperCraft) return@TransferHandler TransferHandler.Result.createFailed( + Text.translatable( + "firmament.recipe.novanilla" + ) + ) var shouldReturn = true if (context.isActuallyCrafting && !useSuperCraft) { val craftingScreen = (screen as? GenericContainerScreen) @@ -85,13 +89,16 @@ class FirmamentReiPlugin : REIClientPlugin { } - val generics = listOf<GenericREIRecipeCategory<*>>( // Order matters: The order in here is the order in which they show up in REI + val generics = listOf<GenericREIRecipeCategory<*>>( + // Order matters: The order in here is the order in which they show up in REI GenericREIRecipeCategory(SBCraftingRecipeRenderer), GenericREIRecipeCategory(SBForgeRecipeRenderer), GenericREIRecipeCategory(SBEssenceUpgradeRecipeRenderer), ) override fun registerCategories(registry: CategoryRegistry) { + if (!RepoManager.shouldLoadREI()) return + registry.add(generics) registry.add(SBMobDropRecipe.Category) registry.add(SBKatRecipe.Category) @@ -105,6 +112,8 @@ class FirmamentReiPlugin : REIClientPlugin { } override fun registerDisplays(registry: DisplayRegistry) { + if (!RepoManager.shouldLoadREI()) return + generics.forEach { it.registerDynamicGenerator(registry) } @@ -114,16 +123,21 @@ class FirmamentReiPlugin : REIClientPlugin { ) registry.registerDisplayGenerator( SBMobDropRecipe.Category.categoryIdentifier, - SkyblockMobDropRecipeDynamicGenerator) + SkyblockMobDropRecipeDynamicGenerator + ) registry.registerDisplayGenerator( SBShopRecipe.Category.categoryIdentifier, - SkyblockShopRecipeDynamicGenerator) + SkyblockShopRecipeDynamicGenerator + ) registry.registerDisplayGenerator( SBKatRecipe.Category.categoryIdentifier, - SkyblockKatRecipeDynamicGenerator) + SkyblockKatRecipeDynamicGenerator + ) } override fun registerCollapsibleEntries(registry: CollapsibleEntryRegistry) { + if (!RepoManager.shouldLoadREI()) return + if (!RepoManager.Config.disableItemGroups) RepoManager.neuRepo.constants.parents.parents .forEach { (parent, children) -> @@ -148,6 +162,8 @@ class FirmamentReiPlugin : REIClientPlugin { } override fun registerEntries(registry: EntryRegistry) { + if (!RepoManager.shouldLoadREI()) return + registry.removeEntryIf { true } RepoManager.neuRepo.items?.items?.values?.forEach { neuItem -> registry.addEntry(SBItemEntryDefinition.getEntry(neuItem.skyblockId)) diff --git a/src/compat/rei/java/moe/nea/firmament/compat/rei/NEUItemEntryRenderer.kt b/src/compat/rei/java/moe/nea/firmament/compat/rei/NEUItemEntryRenderer.kt index d73500a..5e4eee3 100644 --- a/src/compat/rei/java/moe/nea/firmament/compat/rei/NEUItemEntryRenderer.kt +++ b/src/compat/rei/java/moe/nea/firmament/compat/rei/NEUItemEntryRenderer.kt @@ -45,7 +45,7 @@ object NEUItemEntryRenderer : EntryRenderer<SBItemStack> { delta: Float ) { val neuItem = entry.value.neuItem - val itemToRender = if(RepoManager.Config.perfectRenders < RepoManager.PerfectRender.RENDER && !entry.value.isWarm() && neuItem != null) { + val itemToRender = if(!RepoManager.Config.perfectRenders.rendersPerfectVisuals() && !entry.value.isWarm() && neuItem != null) { ItemCache.recacheSoon(neuItem) ItemStack(Items.PAINTING) } else { @@ -72,7 +72,7 @@ object NEUItemEntryRenderer : EntryRenderer<SBItemStack> { @OptIn(ExpensiveItemCacheApi::class) override fun getTooltip(entry: EntryStack<SBItemStack>, tooltipContext: TooltipContext): Tooltip? { - if (!entry.value.isWarm() && RepoManager.Config.perfectRenders < RepoManager.PerfectRender.RENDER_AND_TEXT) { + if (!entry.value.isWarm() && !RepoManager.Config.perfectRenders.rendersPerfectText()) { val neuItem = entry.value.neuItem if (neuItem != null) { val lore = mutableListOf<Text>() diff --git a/src/compat/rei/java/moe/nea/firmament/compat/rei/SBItemEntryDefinition.kt b/src/compat/rei/java/moe/nea/firmament/compat/rei/SBItemEntryDefinition.kt index 1d0a611..740eeeb 100644 --- a/src/compat/rei/java/moe/nea/firmament/compat/rei/SBItemEntryDefinition.kt +++ b/src/compat/rei/java/moe/nea/firmament/compat/rei/SBItemEntryDefinition.kt @@ -46,7 +46,7 @@ object SBItemEntryDefinition : EntryDefinition<SBItemStack> { @OptIn(ExpensiveItemCacheApi::class) override fun asFormattedText(entry: EntryStack<SBItemStack>, value: SBItemStack): Text { val neuItem = entry.value.neuItem - return if (RepoManager.Config.perfectRenders < RepoManager.PerfectRender.RENDER_AND_TEXT || entry.value.isWarm() || neuItem == null) { + return if (!RepoManager.Config.perfectRenders.rendersPerfectText() || entry.value.isWarm() || neuItem == null) { VanillaEntryTypes.ITEM.definition.asFormattedText(entry.asItemEntry(), value.asImmutableItemStack()) } else { Text.literal(neuItem.displayName) diff --git a/src/main/kotlin/features/debug/itemeditor/LegacyItemExporter.kt b/src/main/kotlin/features/debug/itemeditor/LegacyItemExporter.kt index 5fa57cc..ecf3d2c 100644 --- a/src/main/kotlin/features/debug/itemeditor/LegacyItemExporter.kt +++ b/src/main/kotlin/features/debug/itemeditor/LegacyItemExporter.kt @@ -41,6 +41,7 @@ import moe.nea.firmament.util.unformattedString class LegacyItemExporter private constructor(var itemStack: ItemStack) { init { require(!itemStack.isEmpty) + itemStack.count = 1 } var lore = itemStack.loreAccordingToNbt diff --git a/src/main/kotlin/features/items/EtherwarpOverlay.kt b/src/main/kotlin/features/items/EtherwarpOverlay.kt index b1f695a..f6ab1a2 100644 --- a/src/main/kotlin/features/items/EtherwarpOverlay.kt +++ b/src/main/kotlin/features/items/EtherwarpOverlay.kt @@ -19,6 +19,7 @@ object EtherwarpOverlay : FirmamentFeature { object TConfig : ManagedConfig(identifier, Category.ITEMS) { var etherwarpOverlay by toggle("etherwarp-overlay") { false } + var onlyShowWhileSneaking by toggle("only-show-while-sneaking") { true } var cube by toggle("cube") { true } val cubeColour by colour("cube-colour") { ChromaColour.fromStaticRGB(172, 0, 255, 60) } var wireframe by toggle("wireframe") { false } @@ -32,7 +33,7 @@ object EtherwarpOverlay : FirmamentFeature { fun renderEtherwarpOverlay(event: WorldRenderLastEvent) { if (!TConfig.etherwarpOverlay) return val player = MC.player ?: return - if (!player.isSneaking) return + if (TConfig.onlyShowWhileSneaking && !player.isSneaking) return val world = player.world val camera = MC.camera ?: return val heldItem = MC.stackInHand diff --git a/src/main/kotlin/features/macros/RadialMenu.kt b/src/main/kotlin/features/macros/RadialMenu.kt index 2e09c44..9e5222f 100644 --- a/src/main/kotlin/features/macros/RadialMenu.kt +++ b/src/main/kotlin/features/macros/RadialMenu.kt @@ -36,7 +36,11 @@ object RadialMenuViewer { var activeMenu: RadialMenu? = null set(value) { - field = value + if (value?.options.isNullOrEmpty()) { + field = null + } else { + field = value + } delta = Vector2f(0F, 0F) } var delta = Vector2f(0F, 0F) diff --git a/src/main/kotlin/repo/RepoManager.kt b/src/main/kotlin/repo/RepoManager.kt index df89092..c3d1c52 100644 --- a/src/main/kotlin/repo/RepoManager.kt +++ b/src/main/kotlin/repo/RepoManager.kt @@ -7,7 +7,9 @@ import io.github.moulberry.repo.data.NEURecipe import io.github.moulberry.repo.data.Rarity import java.nio.file.Path import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents +import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch +import kotlinx.coroutines.withContext import net.minecraft.client.MinecraftClient import net.minecraft.network.packet.s2c.play.SynchronizeRecipesS2CPacket import net.minecraft.recipe.display.CuttingRecipeDisplay @@ -35,11 +37,13 @@ object RepoManager { branch = "master" save() } - + val enableREI by toggle("enable-rei") { true } val disableItemGroups by toggle("disable-item-groups") { true } val reload by button("reload") { save() - RepoManager.reload() + Firmament.coroutineScope.launch { + RepoManager.reload() + } } val redownload by button("redownload") { save() @@ -56,6 +60,9 @@ object RepoManager { RENDER_AND_TEXT("text"), ; + fun rendersPerfectText() = this == RENDER_AND_TEXT + fun rendersPerfectVisuals() = this == RENDER || this == RENDER_AND_TEXT + override fun asString(): String? = label } @@ -131,16 +138,17 @@ object RepoManager { fun reloadForTest(from: Path) { neuRepo = makeNEURepository(from) - reload() + reloadSync() } - fun reload() { - if (!TestUtil.isInTest && !MC.instance.isOnThread) { - MC.instance.send { - reload() - } - return + + suspend fun reload() { + withContext(Dispatchers.IO) { + reloadSync() } + } + + fun reloadSync() { try { logger.info("Repo reload started.") neuRepo.reload() @@ -168,7 +176,9 @@ object RepoManager { if (Config.autoUpdate) { launchAsyncUpdate() } else { - reload() + Firmament.coroutineScope.launch { + reload() + } } } @@ -196,4 +206,6 @@ object RepoManager { fun getRepoRef(): String { return "${Config.username}/${Config.reponame}#${Config.branch}" } + + fun shouldLoadREI(): Boolean = Config.enableREI } diff --git a/src/texturePacks/java/moe/nea/firmament/features/texturepack/CustomBlockTextures.kt b/src/texturePacks/java/moe/nea/firmament/features/texturepack/CustomBlockTextures.kt index 6506f13..2d7a978 100644 --- a/src/texturePacks/java/moe/nea/firmament/features/texturepack/CustomBlockTextures.kt +++ b/src/texturePacks/java/moe/nea/firmament/features/texturepack/CustomBlockTextures.kt @@ -247,9 +247,6 @@ object CustomBlockTextures { @JvmStatic fun getReplacementModel(block: BlockState, blockPos: BlockPos?): BlockStateModel? { - if (block.block == Blocks.SMOOTH_SANDSTONE_STAIRS) { - println("WEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEWOOOOOOOOOOOOOOOOOOOOOOOOOO") - } return getReplacement(block, blockPos)?.replace(block) } diff --git a/translations/en_us.json b/translations/en_us.json index fa1a551..95b43f1 100644 --- a/translations/en_us.json +++ b/translations/en_us.json @@ -135,6 +135,8 @@ "firmament.config.etherwarp-overlay.cube.description": "Displays a full cube on the block", "firmament.config.etherwarp-overlay.etherwarp-overlay": "Etherwarp Overlay", "firmament.config.etherwarp-overlay.etherwarp-overlay.description": "Display an overlay that tells you what block you will warp to.", + "firmament.config.etherwarp-overlay.only-show-while-sneaking": "Only show while sneaking", + "firmament.config.etherwarp-overlay.only-show-while-sneaking.description": "Displays the Etherwarp overlay only while sneaking.", "firmament.config.etherwarp-overlay.wireframe": "Outline", "firmament.config.etherwarp-overlay.wireframe.description": "Displays a full outline on the block", "firmament.config.fairy-souls": "Fairy Souls", @@ -159,7 +161,7 @@ "firmament.config.fixes.hide-mob-effects": "Hide Potion Effects", "firmament.config.fixes.hide-mob-effects.description": "Hide Potion effects on the right side of your player inventory.", "firmament.config.fixes.hide-potion-effects-hud": "Hide Potion Effects HUD", - "firmament.config.fixes.hide-potion-effects-hud.description": "Hides the potion effects HUd in the top right.", + "firmament.config.fixes.hide-potion-effects-hud.description": "Hides the potion effects HUD in the top right.", "firmament.config.fixes.hide-recipe-book": "No Recipe Book", "firmament.config.fixes.hide-recipe-book.description": "Remove the recipe book from your inventory", "firmament.config.fixes.hide-slot-highlights": "Hide Slot Highlights", @@ -168,19 +170,19 @@ "firmament.config.fixes.peek-chat.description": "Hold this keybinding to view the chat as if you have it opened, but while still being able to control your character.", "firmament.config.fixes.player-skins": "Fix unsigned Player Skins", "firmament.config.fixes.player-skins.description": "Mark all player skins as signed, preventing console spam, and some rendering issues.", - "firmament.config.hud": "Hud", + "firmament.config.hud": "HUD", "firmament.config.hud.day-count": "Day Count", - "firmament.config.hud.day-count-hud": "Day Count Hud", + "firmament.config.hud.day-count-hud": "Day Count HUD", "firmament.config.hud.day-count-hud.description": "Shows day.", "firmament.config.hud.day-count-hud.display": "Day: %s", "firmament.config.hud.day-count.description": "A HUD showing current day.", "firmament.config.hud.fps-count": "FPS Count", - "firmament.config.hud.fps-count-hud": "FPS Count Hud", + "firmament.config.hud.fps-count-hud": "FPS Count HUD", "firmament.config.hud.fps-count-hud.description": "Shows FPS.", "firmament.config.hud.fps-count-hud.display": "FPS: %s", "firmament.config.hud.fps-count.description": "A HUD showing current FPS.", "firmament.config.hud.ping-count": "Ping Count", - "firmament.config.hud.ping-count-hud": "Ping Count Hud", + "firmament.config.hud.ping-count-hud": "Ping Count HUD", "firmament.config.hud.ping-count-hud.description": "Shows Ping.", "firmament.config.hud.ping-count-hud.display": "Ping %s", "firmament.config.hud.ping-count.description": "A HUD showing current Ping.", @@ -306,6 +308,8 @@ "firmament.config.repo.branch.hint": "dangerous", "firmament.config.repo.disable-item-groups": "Disable Item Groups", "firmament.config.repo.disable-item-groups.description": "Disabling item groups can increase performance, but will no longer collect similar items (like minions, enchantments) together.", + "firmament.config.repo.enable-rei": "Enable REI", + "firmament.config.repo.enable-rei.description": "REI is required for viewing Firmaments item list. If you want to use another item list provider like SkyBlockers, you can turn it off here. Without other mods this will make you revert back to the vanilla item list.", "firmament.config.repo.enable-super-craft": "Always use Super Craft", "firmament.config.repo.enable-super-craft.description": "Always use super craft when clicking the craft button in REI, instead of just when holding shift.", "firmament.config.repo.perfect-renders": "Perfect Render", |