feat: persist account-level offline appearance (skin/cape) on OfflineAccount

Open
#266 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
rust
Domain
backend

Research direction

Read the existing OfflineAccount, AccountStore, OfflineProfile, and OfflineServer APIs to see how account JSON is loaded and saved. Start by deciding the open path-semantics and validation questions, then add OfflineAppearance with serde defaults so old account files still load. Done means saving and reloading an account preserves skin/cape/model, and offline_profile() reflects the stored appearance consistently.

Written by the indexing model from the issue text.

Description

Problem

OfflineServer already supports local skins and capes through OfflineProfile::with_skin, with_cape, and with_skin_model, but OfflineAccount persists only username and uuid. Any launcher that offers offline appearance settings has to maintain its own AccountId -> texture path registry outside the account store and rebuild OfflineProfile manually at launch time. That duplicates account-level state and makes the textures easy to get out of sync with the selected account.

Proposal

Persist optional account-level appearance on OfflineAccount:

#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct OfflineAppearance {
    pub skin: Option<PathBuf>,
    pub cape: Option<PathBuf>,
    pub skin_model: SkinModel,
}

impl OfflineAccount {
    pub fn appearance(&self) -> &OfflineAppearance;
    pub fn set_appearance(&mut self, appearance: OfflineAppearance);
    pub fn offline_profile(&self) -> OfflineProfile;
}

AccountStore::save already persists account state, so updating appearance would be set_appearance followed by save.

Questions to settle

  • Should paths be stored as absolute paths or relative to the launcher's storage_root? Relative paths are more portable, but OfflineAccount is created without storage-root context, so offline_profile() would need the root.
  • Should texture existence and PNG validity be checked when setting appearance, when calling offline_profile(), or left to OfflineServer as today?
  • Existing account JSON has no appearance field; #[serde(default)] should keep it backward compatible.

Scope

This should stay limited to account-level defaults. Per-instance overrides, file pickers, image previews, and size validation messaging belong to downstream launchers.

Why upstream

OfflineProfile, OfflineServer, OfflineAccount, and AccountStore all live in Elemental. Persisting these paths next to the account avoids every launcher reimplementing the same registry and keeps offline_profile() consistent with the account identity.

Particle currently constructs OfflineProfile::new(username) directly and has nowhere to persist the user's skin or cape choice.

Dominant language
Rust
Stars
11
Forks
1
Avg merge
3h 32m
Merged PRs (30d)
52

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ElectronicWave/Elemental

All issues in ElectronicWave/Elemental

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.