External resources



Project members


Technical information

Client side
optional
Server side
required
Project ID
switchy banner
An extensible preset system for player customizations provided by other mods.
Works in singleplayer and on server-side.

What is Switchy?

Switchy lets you use commands make presets that are stored with your player data.

Switchy will load modules that tell presets what to store.

When you switch presets, that data is saved to the old preset, then loaded from the new one.

Modules

Most modules provide inter-compatibility with other mods - be sure to follow the links.

You can hotswap these features out-of-the box by installing their relevant mods:

More functionality can be added with these Addons:

  • Switchy Inventories - separate inventories, ender chests, and trinkets (all disabled by default)
  • Switchy Teleport - separate player position and spawn points (all disabled by default)

These mods have Switchy support built-in:

  • RPGStats - All 6 stats can be kept per-preset

Showcase

Quick Start Guide

Remember, switching does nothing on its own! Make sure you install a mod from above.

  1. Use /switchy list to see your current presets

  2. use /switchy rename default [name] to give your starting preset a name

  3. /switchy new [name] will create and switch to a new preset

  4. /switchy set [name] or /switch [name] will switch between existing presets

Customize your modules

When a module is Enabled, it makes things "switch" (load and save) per-preset.

/switchy module enable/disable [name] will toggle this for your presets.

Import/Export

These commands require switchy to also be installed on the client.

/switchy export will export all of your presets and modules to a file.

You can then move to another server or singleplayer world.

/switchy_client import [filename] will import all allowed modules (see below).

/switchy_client import [filename] [exclude] [operator] will import all allowed modules, except modules in [exclude], plus any modules in [operator] if you have OP level 2. You can use ~ to specify no modules.

Import Configuration

Switchy doesn't and will not support permissions on its basic commands, and has no way to enable or disable modules server-wide.

However, you can minorly configure which players can import module data from their client in /config/switchy/config.toml

Modules will be listed with one of four import settings:

  • ALLOWED: Importable by any player - can be changed to OPERATOR (e.g. origins)
  • OPERATOR: Importable by operators when specified - can be changed to ALLOWED (e.g. inventories)
  • ALWAYS_ALLOWED: Importable by any player - can't be changed (e.g. nicknames/skins)
  • NEVER: Can't be imported due to technical limitations - can't be changed

Developers

Switchy can be added to your project with modImplementation "folk.sisby:switchy-core:x.x.x" and this repo:

maven {
    url = "https://maven.proxyfox.dev/"
    content {
        includeGroup "folk.sisby"
    }
}

switchy-core includes commands and the API. For our jar releases, it's packaged with switchy-cardinal which provides data-driven CCA switchy modules and an API, and switchy-compat which provides the built-in modules for drogtor etc.

Adding new Modules allows more data to be switched per-preset. They only need to:

  • Load and Save their data using NBT.
  • Save their data from the player
  • Load their data to the player

Just implement PresetModule and register it with PresetModuleRegistry - See Switchy Inventories for an example.

Switchy also provides an entrypoint, which you can use to skip checking if switchy is loaded, an events API that can let your mod (client or server) know which preset is loaded and when, and a simple API for switching and getting the names of presets and modules.

Data-Driven CCA Modules

If your mod uses the Cardinal Components API to store its player/entity data, you can instead register a module using an instance of CardinalSerializerCompat.

If your component performs all of its necessary sync logic within writeToNbt/readFromNbt (or has none) - you can instead use the static register method or even define the module in data.

Any data matching data/*/switchy_cca_modules/*.json will be loaded like so:

  • Top level key: Cardinal component ID
    • default: boolean, module is enabled for players by default.
    • importable: See import configuration above.
    • ifModLoaded: a mod ID to check before trying to register the module.

Further Info

This mod is primarily motivated by improving accessibility for plural systems.
Check out the Plural Respect Document.

Fabric?

Switchy is inescapably a plural mod. It's motivated and maintained by a plural system.

Unlike the Quilt development community, the fabric development community is not safe for plural systems. Try moving your modlist to Quilt/QSL!

Afterword

All mods are built on the work of many others.

Created for ModFest: Singularity

We made this mod (up to v1.2.1) for Modfest: Singularity! However, we intend to maintain this mod into the future.

This mod is included in Tinkerer's Quilt - our modpack about ease of play and self-expression.

We're open to suggestions for how to implement stuff better - if you see something wonky and have an idea - let us know.