Remove and replace vanilla parts
This page shows how to build your own server from the same plugins as the stock one, how to leave a plugin out, and how to pass settings to the plugins.
In Paper you start from a finished server and add plugins. In mcrs you start from a group of plugins and take parts out, so a lobby can run without world generation and a test can run without lighting. The examples come from repository files, and we did not run them outside the repository tests.
The server is a group of plugins
Section titled “The server is a group of plugins”MinecraftServerPlugins is a Bevy PluginGroup, which is a set of plugins that you add to the app as one value. Its four fields are the parts that take settings:
pub struct MinecraftServerPlugins { pub core: ServerCorePlugin, pub worlds: DimensionWorldsPlugin, pub world_gen: WorldGenPlugin, pub network: ServerNetworkPlugin,}crates/mcrs_minecraft_server/src/lib.rs:43-48
build() adds the rest of the vanilla server. The members, in the order build() adds them, are the server core, world generation registries, the command engine, vanilla commands, world commands, dimension worlds, chat, entity physics, player pose, entity attributes and player vitals, respawn, death drops, death messages, the sprint attribute, creative reach, item entities, falling blocks, block drops and support, mob brains, item and inventory saving, block placement, arm swings, player attacks, world generation, lighting and the network.1
impl PluginGroup for MinecraftServerPlugins { fn build(self) -> PluginGroupBuilder { PluginGroupBuilder::start::<Self>() .add(self.core) .add(WorldgenRegistriesPlugin) .add(CommandPlugin::<VanillaCommands>::new()) .add(VanillaCommandsPlugin) .add(WorldCommandsPlugin) .add(self.worlds) .add(VanillaChatPlugin) .add(VanillaEntityPhysicsPlugin) .add(VanillaPlayerPosePlugin) .add(VanillaEntityAttributesPlugin) .add(VanillaRespawnPlugin) .add(VanillaDeathDropsPlugin) .add(VanillaDeathMessagesPlugin) .add(VanillaSprintAttributePlugin) .add(VanillaCreativeRangePlugin) .add(VanillaItemEntityPlugin) .add(VanillaFallingBlockPlugin) .add(VanillaBlocksPlugin::default()) .add(VanillaMobBrainPlugin) .add(VanillaItemPlugin) .add(VanillaBlockPlacePlugin) .add(VanillaSwingPlugin) .add(VanillaPlayerAttackPlugin) .add(self.world_gen) .add(LightingPlugin) .add(self.network) }}crates/mcrs_minecraft_server/src/lib.rs:85-115
You can disable or replace each member without editing the server crate. A member that needs another one panics when the group builds and names the missing plugin. You get the error at start, so you do not have to trace a missing resource at the first tick.
The vanilla gameplay lives in plugins above the engine. Each of them is removable on its own, and most of them reach every dimension world through add_dimension_plugin.2
Disable a member with disable
Section titled “Disable a member with disable”The binary switches mob AI off like this:
if !settings.mob_ai { server = server.disable::<VanillaMobBrainPlugin>();}disable::<T>() is a method of the Bevy plugin group builder, and T is the plugin you leave out. A repository test uses the same method to start a server without world generation and lighting:
fn a_client_without_an_app_joins_the_embedded_server_offline() { let mut plugins = MinecraftServerPlugins::embedded(); plugins.core.asset_path = Some(ASSETS.to_owned()); plugins.network.announce_on_lan = false; let mut app = App::new(); app.add_plugins( plugins .build() .disable::<WorldGenPlugin>() .disable::<LightingPlugin>(), ); let stop = StopOnDrop(Arc::new(AtomicBool::new(false)));crates/mcrs_minecraft_server/tests/it/client_join.rs:29-40
That test also calls MinecraftServerPlugins::embedded(). It gives a server that runs inside another process. Such a server listens on loopback only, takes a port that the OS assigns, and leaves the task pools to the host app.
impl MinecraftServerPlugins { #[must_use] pub fn with_local_packs(mut self, extra: impl IntoIterator<Item = String>) -> Self { self.core.local_packs.extend(extra); self }
pub fn embedded() -> Self { let defaults = Self::default(); Self { core: ServerCorePlugin { owns_task_pools: false, ..defaults.core }, network: ServerNetworkPlugin::embedded(), ..defaults } }}crates/mcrs_minecraft_server/src/lib.rs:65-83
To host such a server in your own program, pass a closure that builds the app to ServerThread::start from mcrs_minecraft_engine_server, and the server runs on a thread of its own. address() returns the address once the server listens, request_shutdown() asks the server to disconnect the players, save the world and exit, and finish() asks the same and waits for the thread to end. The client starts its singleplayer server this way, and the field extend_server of its LocalServerPlugin takes a function that adds your own plugins to that server.
Replace death, respawn or swing rules
Section titled “Replace death, respawn or swing rules”The group exposes these members separately:
| Member | What disabling it removes | Replacement |
|---|---|---|
VanillaRespawnPlugin |
the client’s respawn command becoming a world-spawn request | write RespawnRequest in the player’s dimension |
VanillaDeathDropsPlugin |
vanilla inventory, cursor and crafting-grid drops on death | read Died and choose your own drop policy |
VanillaDeathMessagesPlugin |
vanilla death text and its chat broadcast | write DeathMessage in PlayerDeathSet::Describe; broadcast your text separately if needed |
VanillaSwingPlugin |
punch and piercing-weapon stab inputs | write SwingPlayer; accepted placements and hand drops have their own producers |
VanillaPlayerAttackPlugin |
attack packets becoming damage and knockback | supply your own attack policy3 |
Player vitals remain in VanillaEntityAttributesPlugin, which installs PlayerVitalsPlugin alongside the attribute plugins. Replacing the respawn policy keeps health, death packets and the engine’s restore mechanism.4 Death drops and messages are independent members.5 Swing requests use the engine cooldown and observer replication even when your own system writes them.6
Handle damage, death and respawn explains the damage filters and respawn limits. Inventory lists what the drop policy does.
Settings are plugin fields
Section titled “Settings are plugin fields”The binary reads its settings from the environment and turns them into plugin fields in src/main.rs:
let settings = ServerSettings::read( |name| std::env::var(format!("MCRS_{name}")).ok(), |error| { if matches!(error.name, "FORWARDING" | "PROXY_UPSTREAMS") { unreadable_proxy_setting.get_or_insert(error); } else { bevy_log::warn!("{error}"); } },);if let Some(error) = unreadable_proxy_setting { bevy_log::error!( "MCRS_{}={:?} is not {}; the server does not start", error.name, error.value, error.expected ); return AppExit::error();}let network = match network(&settings) { Ok(network) => network, Err(error) => { bevy_log::error!("{error}"); return AppExit::error(); }};let mut server = MinecraftServerPlugins { core: ServerCorePlugin { compute_threads: settings.compute_threads, ..MinecraftServerPlugins::default().core }, worlds: DimensionWorldsPlugin { world: world_folder(), ops, seed: settings.world_seed, preset: settings.world_preset.clone(), default_game_mode: settings.default_game_mode, spawn: settings.spawn, ..Default::default() }, world_gen: WorldGenPlugin, network,}.with_local_packs(settings.local_packs.iter().cloned()).build();Only the binary does this. A library crate does not read an environment variable or a file for its settings, and every setting is a field of the plugin that uses it.7
The environment variables of the binary are the fields of ServerSettings. Most variables carry the name of their field in upper case with the prefix MCRS_, such as MCRS_MOB_AI for mob_ai. Environment variables has the list with the defaults.
In your own program, skip ServerSettings and fill the plugin fields yourself. An embedded server in a test then starts with explicit settings, whatever the shell exported.
MinecraftServerPlugins::with_local_packs(extra) adds local data pack names to the built-in selection. Add and check data packs describes their layout and precedence. DimensionWorldsPlugin.spawn takes an optional [x, y, z] join position; Worlds and saves describes the override rules. The binary and the client’s integrated server pass both settings through these APIs.8
The neighbour-update chain limit is another plugin field, VanillaBlocksPlugin.chain_limit. Block placing, breaking and drops describes its bounded and unlimited forms.
You cannot supply your own chunks yet
Section titled “You cannot supply your own chunks yet”Next: Hook into block placing, breaking and drops.
Footnotes
Section titled “Footnotes”-
Works#279 Splits the server plugin into a group of removable plugins. ↩
-
Works#282 Moves vanilla gameplay out of the server crate into removable plugins. ↩
-
Works#1106 Adds a removable player attack plugin and the packet damage filter. ↩
-
Works#1082 Separates player vitals from the vanilla respawn policy. ↩
-
Works#1084 Adds separate group members for death drops and death messages. ↩
-
Works#1064 Adds the vanilla swing input plugin and the public engine request. ↩
-
Works#278 The server is configured only through its plugin. ↩
-
Works#1089 Adds local data packs and a join position through plugin settings. ↩
-
WIP#281 Plans the chunk source as a replaceable plugin point, with empty and flat sources. ↩
Sources and verification
Verified: 26.4-snapshot-7, 1cf84286c, 2026-11-30
- crates/mcrs_minecraft_server/src/lib.rs
- src/main.rs
- crates/mcrs_minecraft_server/tests/it/client_join.rs
- crates/mcrs_minecraft_server_settings/src/server_settings.rs
- crates/mcrs_minecraft_engine_server/src/require.rs
- crates/mcrs_minecraft_engine_server/src/server_thread.rs
- crates/mcrs_minecraft_engine_server/src/shutdown.rs
- crates/mcrs_minecraft_client/src/local_server.rs
- PR #969
- PR #1003
- issue #278
- issue #279
- issue #281
- issue #282
- crates/mcrs_minecraft_server/src/vanilla_death_drops.rs
- crates/mcrs_minecraft_server/src/vanilla_death_messages.rs
- crates/mcrs_minecraft_server/src/vanilla_swing.rs
- crates/mcrs_minecraft_engine_player/src/swing.rs
- crates/mcrs_minecraft_engine_player_vitals/src/player_vitals_plugin.rs
- crates/mcrs_minecraft_engine_player_vitals/src/player_death_set.rs
- crates/mcrs_minecraft_vanilla_death/src/death_messages_plugin.rs
- crates/mcrs_minecraft_vanilla_respawn/src/respawn_plugin.rs
- PR #1064
- PR #1082
- PR #1084
- PR #1106
- PR #1089
- crates/mcrs_minecraft_engine_server/src/dimension_worlds_plugin.rs
- crates/mcrs_minecraft_engine_shared/src/spawn_override.rs
- crates/mcrs_minecraft_engine_player/src/consume_inbound_player_spawn.rs
- crates/mcrs_minecraft_datapack/src/root.rs
- crates/mcrs_minecraft_engine_server/src/configuration.rs
- crates/mcrs_minecraft_server/src/vanilla_blocks.rs
Related open issues: