From 3cd834070473f6d92f6de5b28b3fc869039b9211 Mon Sep 17 00:00:00 2001 From: neoapps-dev Date: Mon, 20 Apr 2026 15:26:47 +0300 Subject: [PATCH] fix: make seed based on username, change skin pack skin name --- src/context/LauncherContext.tsx | 2 +- src/hooks/useSkinSync.ts | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/context/LauncherContext.tsx b/src/context/LauncherContext.tsx index d264b68..accee14 100644 --- a/src/context/LauncherContext.tsx +++ b/src/context/LauncherContext.tsx @@ -53,7 +53,7 @@ export function LauncherProvider({ children }: { children: React.ReactNode }) { customEditions: configRaw.customEditions, setCustomEditions: configRaw.setCustomEditions, }); - const skinSync = useSkinSync({ profile: configRaw.profile, editions: gameRaw.editions }); + const skinSync = useSkinSync({ username: configRaw.username, profile: configRaw.profile, editions: gameRaw.editions }); const audioRaw = useAudioController({ musicVol: configRaw.musicVol, sfxVol: configRaw.sfxVol, diff --git a/src/hooks/useSkinSync.ts b/src/hooks/useSkinSync.ts index f2ee326..3ff1d72 100644 --- a/src/hooks/useSkinSync.ts +++ b/src/hooks/useSkinSync.ts @@ -9,11 +9,12 @@ interface Edition { } interface UseSkinSyncProps { + username: string; profile: string; editions: Edition[]; } -export function useSkinSync({ profile, editions }: UseSkinSyncProps) { +export function useSkinSync({ username, profile, editions }: UseSkinSyncProps) { const [skinUrl, setSkinUrl] = useLocalStorage( "lce-skin", "/images/Default.png", @@ -101,7 +102,8 @@ export function useSkinSync({ profile, editions }: UseSkinSyncProps) { return Math.abs(hash).toString().padStart(8, "0").slice(-8); }; - const seededId = getSeededId(profile); + const seededId = getSeededId(username); + const packId = seededId.slice(-4); const files: any[] = [ { id: "0", @@ -112,7 +114,7 @@ export function useSkinSync({ profile, editions }: UseSkinSyncProps) { properties: [ { key: "PACKID", - value: "9999", + value: packId, }, ], }, @@ -125,7 +127,7 @@ export function useSkinSync({ profile, editions }: UseSkinSyncProps) { properties: [ { key: "DISPLAYNAME", - value: "Custom Skin", + value: username, }, { key: "GAME_FLAGS", @@ -187,7 +189,7 @@ export function useSkinSync({ profile, editions }: UseSkinSyncProps) { return () => { cancelled = true; }; - }, [skinUrl, capeUrl, profile, editions, skinIsSlim]); + }, [skinUrl, capeUrl, username, profile, editions, skinIsSlim]); return { skinUrl,