logo
Expand description

A Rust framework for building Minecraft servers.

At a high level, a Valence Server is a collection of Clients, Entities, and Worlds. When a client connects to the server they are added to the collection of Clients. After connecting, clients should be assigned to a World where they can interact with the entities and Chunks that are a part of it.

The Valence documentation assumes some familiarity with Minecraft and its mechanics. See the Minecraft Wiki for general information and wiki.vg for protocol documentation.

For more information, see the repository README.

Logging

Valence uses the log crate to report errors and other information. You may want to use a logging implementation such as env_logger to see these messages.

An Important Note on mem::swap

In Valence, many types are owned by the library but given out as mutable references for the user to modify. Examples of such types include World, Chunk, Entity, and Client.

You must not call mem::swap on these references (or any other function that would move their location in memory). Doing so breaks invariants within the library and the resulting behavior is safe but unspecified. You can think of these types as being pinned.

Preventing this illegal behavior using Rust’s type system was considered too cumbersome, so this note has been left here instead.

Examples

See the examples directory in the source repository.

Modules

Biome configuration and identification.

Blocks and related types.

Chunks and related types.

Connections to the server after logging in.

Configuration for the server.

Dimension configuration and identification.

Entities in a world.

Namespaced identifiers.

A serde library for the serialization and deserialization of Minecraft’s Named Binary Tag (NBT) format.

The player list (tab list).

Player skins and capes.

Provides low-level access to the Minecraft protocol.

The heart of the server.

Efficient spatial entity queries.

Formatted text.

Miscellaneous utilities.

Generate and parse universally unique identifiers (UUIDs).

Generic 2D-3D math swiss army knife for game engines, with SIMD support and focus on convenience.

A space on a server for objects to occupy.

Macros

Convenience macro for constructing an Ident from a format string.

Constants

The namespace for this library used internally for identifiers.

The Minecraft protocol version this library currently targets.

Minecraft’s standard ticks per second (TPS).

The name of the Minecraft version this library currently targets, e.g. “1.8.2”

Functions

Consumes the configuration and starts the server.

Type Definitions

A discrete unit of time where 1 tick is the duration of a single game update.

Attribute Macros

Used on Config to allow for async methods in traits.