Описание
Serverside player profiles for hotseat multiplayer, adventure maps, and plural systems.
Requires Connector and FFAPI on (neo)forge.
---
**Switchy** allows players to create and switch between **player profiles**, which save part of their player data.
This is both **data-driven** and **player-customizable**. Here's a profile with [Styled Nicknames](https://modrinth.com/mod/styled-nicknames) and [Fabric Tailor](https://modrinth.com/mod/fabrictailor) (+[SCH](https://github.com/sisby-folk/ServerChatHeads/releases/tag/1.0.0)):

Support is also built-in (via data) for [Lampblack Pronouns](https://modrinth.com/mod/lampblack), [Trinkets](modrinth.com/mod/trinkets)/[Accessories](https://modrinth.com/mod/accessories), [Pehkui](https://modrinth.com/mod/pehkui) (width/height), and [Origins](https://modrinth.com/mod/origins).
You can even fluently chat using the display names of other profiles, just like [PluralKit](https://pluralkit.me/):

This is fully compatible with well-behaved chat bridges, like [our cantilever fork](https://github.com/sisby-folk/cantilever/releases/tag/2.0-tailor)!
## Usage
> _**Disclaimer**: All mods that manipulate player data have a save corruption risk!
Always take backups of your worlds, especially when updating mods._
**Just run `/switchy` and follow the hints!** This covers renaming, toggling components, and making new profiles.
After this, you can freely switch profiles via `/switch ` or by clicking `` in the profile list.
Switching into a profile restores component data to **the state it was in was when the profile was last used**.
So to change e.g. a fabric tailor skin for a profile, switch into the profile first, set the skin, and switch out.
You can use `/switchy say` to send a chat message as if you were switched into a specific profile.
Use `/switchy edit tag text` to match regular chat messages based on a pattern.
Display names look slightly different to styled nicknames/chat, so just adjust their configs to match.
Profiles are per-world, so speed things up by running `/switchy export` to get your name/skin data to save to a .json file.
To import, upload the file (e.g. to [tmpfiles.org](https://tmpfiles.org/)) and paste the link into `/switchy import all `.
You can also import from [PK](https://pluralkit.me/guide/#exporting-your-pluralkit-data) (and import from / export to [Utter](https://utter.y2k.diy/)) - use `/switchy import ` to filter imports.
## Compatibility
> Note: If Switchy crashes your 1.20 modpack, set `fastSingleplayerReconnect` to `false` in `config/switchy.toml`
For compatibility with new mods, components are defined like so:
```json5
// data/minecraft/switchy_components/inventory/ender_chest.json (minecraft:inventory/ender_chest)
{
"enabled": true, // whether to load the component at all. use this instead of deleting default files, as they'll regenerate.
"codec": "inventory", // which codec (from the registry in SwitchyComponentTypes) to use to deserialize the data. defaults to "nbt" (passthrough)
"path": "EnderItems", // NBT path targeting the part of player.dat to load from / modify to
"preview": "inventory", // which text previewer (from the registry in SwitchyComponentTypes) to use in chat. null = toString(), use "trunc" for long data. Start with $ to use an NBT path for passthrough components.
"prefix": "👁 ", // a prefix to add to the text preview, for glanceability
"emptyChecker": "inventory", // which empty checker (from the registry in SwitchyComponentTypes) to use to prevent profile deletion for precious data. Start with $ to use an NBT path for passthrough components.
"group": "inventory", // components with a matching group ID will be previewed and toggled as if they're one component
"default": [], // default value. JSON serialized. set to "$copy" to copy the value from previous. set to null or omit to delete the key from player data as the initial value.
"hidden": false // hides the component preview in the profiles list (still shown in the components list)
}
```
Feel free to PR components (and previewers/etc with **no dependencies**) into the main mod - see [existing examples](https://github.com/sisby-folk/switchy/tree/1.20/src/main/resources/data).
Switching data outside player NBT requires an addon. API TBD - Interested addon devs can hit up the [issues page](https://github.com/sisby-folk/switchy/issues).
## Afterword
If you're a plural system (or a friend to one) and appreciate our work, please consider reading and sharing [sys.guide](https://sys.guide), our plurality handbook.
Switchy was our first original minecraft mod, made during the mod jam [ModFest: Singularity](https://modfest.net/singularity/submissions).
Since making it, the minecraft modding community has given us friendship, mentorship,
endless favours, an outlet for self-expression, and reinforced our passion for software as an art.
Everyone who's been a part of that - and you should know who you are - thank you.