Ampflower / switchy

A quilt mod that combines player personalization features from other mods into presets.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

<iframe width="896" height="504" src="https://www.youtube.com/embed/gkOGZUJOtR4" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

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 modules provide switchy with all of its practical functionality, but despite this, they're only required to do four things:

  • Save themselves to NBT
  • Load themselves from NBT
  • Save data to themselves from the player
  • Load data from themselves to the player

Because mods (and minecraft) often have to do these things already, modules can be extremely simple.

If you'd like to develop your own addon module, feel free to use Switchy Inventories as an example.

To make a module, just implement PresetModule and register it using PresetModuleRegistry.

There's also an API for basic operations like getting the name of a player's presets, and switching to a specific preset.

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.

About

A quilt mod that combines player personalization features from other mods into presets.

License:GNU Lesser General Public License v3.0


Languages

Language:Java 100.0%