Skip to main content

Crate centralcore

Crate centralcore 

Source
Expand description

§CentralCore

CentralCore is an open-source Rust library for building Minecraft Java Edition launchers. It provides an asynchronous, UI-independent engine behind the CentralCore facade.

§Features

  • Vanilla, Fabric, and Forge installation and launch planning.
  • Managed Java discovery, installation, verification, and selection.
  • Extensible authentication and secure native credential storage.
  • Inspectable Install / Verify / Repair / Update workflows.
  • Provider-defined optional components and dependency resolution.
  • Verified offline cache reuse and recovery.
  • Signed providers with explicit local trust and anti-rollback checks.
  • Structured events for desktop, CLI, IPC, and automation hosts.

§Quick start

This example follows the public API used by the packaged vanilla example:

use centralcore::{CentralCore, InstanceSpec};

#[tokio::main]
async fn main() -> centralcore::Result<()> {
    let core = CentralCore::builder()
        .data_dir("./centralcore-data")
        .build()
        .await?;

    let instance = core
        .instances()
        .create(InstanceSpec::vanilla("demo", "Demo", "1.21.1")?)
        .await?;
    let cancellation = core.downloads().cancellation_token();
    let plan = core
        .minecraft()
        .resolve_install_plan(&instance, &cancellation)
        .await?;

    println!("{} files are required", plan.downloads().len());
    Ok(())
}

§Architecture / UI independence

CentralCore contains no frontend framework and does not own an application event loop. A desktop UI, command-line tool, server, or IPC adapter owns presentation and calls the same service API. Long-running operations expose typed, inspectable plans and emit UI-agnostic events through events.

§Main services

CentralCore provides access to focused managers:

§Security / signed providers

Remote providers can require detached Ed25519 signatures. Trust is local: provider documents cannot approve their own keys. The trust and providers modules implement explicit key approval, rotation, revocation, verified snapshots, and rollback protection. Applications should require signatures for production remote providers and protect their publisher-side private keys outside CentralCore.

§Further documentation

Re-exports§

pub use cache::CacheManager;
pub use cache::CachePolicy;
pub use config::CoreConfig;
pub use errors::Error;
pub use errors::Result;
pub use events::CoreEvent;
pub use events::EventBus;
pub use events::EventEnvelope;
pub use events::EventId;
pub use instance::Instance;
pub use instance::InstanceId;
pub use instance::InstanceService;
pub use instance::InstanceSpec;
pub use instance::InstanceStatus;
pub use process::DetachedInstance;
pub use process::ProcessExit;
pub use process::ProcessManager;
pub use process::ProcessRecoveryReport;
pub use process::RunningInstance;
pub use trust::TrustStore;

Modules§

auth
Extensible, UI-independent authentication flows and normalized identities.
cache
Versioned shared-cache metadata, verification, and safe pruning.
config
Versioned local CentralCore configuration.
download
Central HTTP client, resumable downloads, integrity checks, and cancellation.
errors
Error types shared by CentralCore services.
events
Typed, UI-agnostic events emitted by CentralCore.
files
Safe relative paths and provider-neutral file manifests.
instance
Isolated instance model and local persistence.
java
Java runtime policy and local discovery.
loaders
Generic mod-loader planning, registry, execution, and persistence.
minecraft
Official Minecraft metadata, Vanilla installation, and launch planning.
mods
Mod metadata and user selection policy.
platform
Normalized host platform information.
process
Asynchronous multi-instance Minecraft process lifecycle management.
providers
Backend-neutral instance providers and the static JSON implementation.
trust
Public-key trust, detached provider signatures, and explicit key rotation.

Structs§

CentralCore
Main entry point for applications embedding CentralCore.
CentralCoreBuilder
Builder for CentralCore.

Functions§

config_path
Returns the conventional config file below a data directory.