From 35659983c37f78f23e22e0daad5c16f686f8fb33 Mon Sep 17 00:00:00 2001 From: tdgao Date: Thu, 20 Aug 2026 13:10:50 -0600 Subject: [PATCH] feat: exclude loaders from randomizing --- .../icon-editor-modal/editor-catalog.ts | 44 ++++++++++++++++--- .../icon-editor-modal/index.vue | 4 +- 2 files changed, 41 insertions(+), 7 deletions(-) diff --git a/apps/app-frontend/src/components/ui/instance_settings/icon-editor-modal/editor-catalog.ts b/apps/app-frontend/src/components/ui/instance_settings/icon-editor-modal/editor-catalog.ts index 203862a8de..7fa45b51a5 100644 --- a/apps/app-frontend/src/components/ui/instance_settings/icon-editor-modal/editor-catalog.ts +++ b/apps/app-frontend/src/components/ui/instance_settings/icon-editor-modal/editor-catalog.ts @@ -1,4 +1,4 @@ -import { defineMessages } from '@modrinth/ui' +import { defineMessages, type MessageDescriptor } from '@modrinth/ui' import backpack from '@/assets/instance-icons/backpack.png' import beacon from '@/assets/instance-icons/beacon.png' @@ -207,6 +207,14 @@ const names = defineMessages({ quilt: { id: 'instance.icon-editor.symbol.quilt', defaultMessage: 'Quilt' }, }) +export interface SymbolOption { + id: string + name: MessageDescriptor + asset: string + category: 'loader' | 'modded' | 'vanilla' + excludeFromRandomization?: boolean +} + export const backgroundOptions = [ { id: 'rose', @@ -351,10 +359,34 @@ export const symbolOptions = [ // loaders ///////////////////////// - { id: 'fabric', name: names.fabric, asset: fabric, category: 'loader' }, - { id: 'forge', name: names.forge, asset: forge, category: 'loader' }, - { id: 'neoforge', name: names.neoForge, asset: neoForge, category: 'loader' }, - { id: 'quilt', name: names.quilt, asset: quilt, category: 'loader' }, + { + id: 'fabric', + name: names.fabric, + asset: fabric, + category: 'loader', + excludeFromRandomization: true, + }, + { + id: 'forge', + name: names.forge, + asset: forge, + category: 'loader', + excludeFromRandomization: true, + }, + { + id: 'neoforge', + name: names.neoForge, + asset: neoForge, + category: 'loader', + excludeFromRandomization: true, + }, + { + id: 'quilt', + name: names.quilt, + asset: quilt, + category: 'loader', + excludeFromRandomization: true, + }, // Cobblemon: Poké Ball { id: 'poke_ball', name: names.pokeBall, asset: pokeBall, category: 'modded' }, @@ -455,7 +487,7 @@ export const symbolOptions = [ { id: 'lantern', name: names.lantern, asset: lantern, category: 'vanilla' }, { id: 'tnt', name: names.tnt, asset: tnt, category: 'vanilla' }, { id: 'command_block', name: names.commandBlock, asset: commandBlock, category: 'vanilla' }, -] as const +] as const satisfies readonly SymbolOption[] export type BackgroundId = (typeof backgroundOptions)[number]['id'] export type SymbolId = (typeof symbolOptions)[number]['id'] diff --git a/apps/app-frontend/src/components/ui/instance_settings/icon-editor-modal/index.vue b/apps/app-frontend/src/components/ui/instance_settings/icon-editor-modal/index.vue index 730e3a0164..7ecf4ba41b 100644 --- a/apps/app-frontend/src/components/ui/instance_settings/icon-editor-modal/index.vue +++ b/apps/app-frontend/src/components/ui/instance_settings/icon-editor-modal/index.vue @@ -27,6 +27,7 @@ import { DEFAULT_SYMBOL_ID, RANDOM_CONFIG_BLACKLIST, type SymbolId, + type SymbolOption, symbolOptions, } from './editor-catalog' @@ -202,7 +203,8 @@ function surpriseMe() { const configurations = backgroundOptions.flatMap((background) => symbolOptions .filter( - (symbol) => + (symbol: SymbolOption) => + !symbol.excludeFromRandomization && background.id !== selectedBackground.value && symbol.id !== selectedSymbol.value && !RANDOM_CONFIG_BLACKLIST.some(