Expand description
Contains the most frequently used items in Valence projects.
This is usually glob imported like so:
use valence::prelude::*; // Glob import.
let mut app = App::empty();
app.add_systems(Update, || println!("yippee!"));
app.update()
// ...
Re-exports§
pub use valence_server::message::SendMessage as _;
pub use valence_server::title::SetTitle as _;
pub use super::DefaultPlugins;
pub use bevy_ecs;
pub use valence_server::ident;
Macros§
- ident
- Creates a new
Ident
at compile time from a string literal. A compile error is raised if the string is not a valid resource identifier.
Structs§
- Added
- A filter on a component that only retains results the first time after they have been added.
- Advancement
- Advancement’s id. May not be updated.
- Advancement
Bundle - Components for advancement that are required
Optional components:
AdvancementDisplay
[Parent
] - parent advancement - Advancement
Client Update - Advancement
Criteria - Criteria’s identifier. May not be updated
- Advancement
Display - Advancement display. Optional component
- Advancement
Requirements - Requirements for advancement to be completed. All columns should be completed, column is completed when any of criteria in this column is completed.
- Advancement
TabChange Event - This event sends when the client changes or closes advancement’s tab.
- AnyOf
- The
AnyOf
query parameter fetches entities with any of the component types included in T. - App
App
is the primary API for writing user applications. It automates the setup of a standard lifecycle and provides interface glue for plugins.- AppType
Registry - A
Resource
storing [TypeRegistry
] for type registrations relevant to a whole app. - Biome
- BiomeId
- Biome
Registry - Block
- Represents a complete block, which is a pair of block state and optional NBT data for the block entity.
- Block
Pos - Represents an absolute block position in world space.
- Block
Ref - Like
Block
, but immutably referenced. - Block
State - Represents the state of a block. This does not include block entity data such as the text on a sign, the design on a banner, or the content of a spawner.
- Changed
- A filter on a component that only retains results the first time after they have been added or mutably dereferenced.
- Chunk
Layer - A
Component
containing the chunks and dimension information of a Minecraft world. - Chunk
Pos - The X and Z position of a chunk.
- Chunk
View - Represents the set of all chunk positions that a client can see, defined by
a center chunk position
pos
and view distancedist
. - Client
- The main client component. Contains the underlying network connection and packet buffer.
- Client
Spawn Query - A convenient
QueryData
for obtaining client spawn components. Also seeClientSpawnQueryReadOnly
. - Client
Spawn Query Read Only - Automatically generated [
WorldQuery
] type for a read-only variant ofClientSpawnQuery
. - Commands
- A
Command
queue to perform structural changes to theWorld
. - Compound
- A map type with
String
keys andValue
values. - Cursor
Item - The item stack that the client thinks it’s holding under the mouse cursor.
- DVec2
- A 2-dimensional vector.
- DVec3
- A 3-dimensional vector.
- Deferred
- A
SystemParam
that stores a buffer which gets applied to theWorld
duringapply_deferred
. This is used internally byCommands
to deferWorld
mutations. - Despawned
- A marker
Component
for entities that should be despawned at the end of the tick. - Digging
Event - Dimension
Type - Dimension
Type Registry - Entity
- Lightweight identifier of an entity.
- Entity
Kind - Identifies the type of an entity. As a component, the entity kind should not be modified.
- Entity
Layer - A
Component
containing Minecraft entities. - Entity
Layer Id - Contains the entity layer an entity is on.
- Entity
Manager - A
Resource
which maintains information about all spawned Minecraft entities. - Entity
Mut - Provides mutable access to a single entity and all of its components.
- Entity
Ref - A read-only reference to a particular
Entity
and all of its components. - Entity
World Mut - A mutable reference to a particular
Entity
, and the entire world. This is essentially a performance-optimized(Entity, &mut World)
tuple, which caches theEntityLocation
to reduce duplicate lookups. - Equipment
- Contains the visible equipment of a
LivingEntity
, such as armor and held items. By default this is not synced with a player’svalence_inventory::Inventory
, so the armor the player has equipped in their inventory, will not be visible by other players. You would have to change the equipment in this component here or attach theEquipmentInventorySync
component to the player entity to sync the equipment with the inventory. - Erased
Network Callbacks - A type-erased wrapper around an
NetworkCallbacks
object. - Event
Loop Post Update - Event
Loop PreUpdate - Event
Loop Update - Event
Reader - Reads events of type
T
in order and tracks which events have already been read. - Event
Writer - Sends events of type
T
. - Events
- An event collection that represents the events that occurred within the last two
Events::update
calls. Events can be written to using anEventWriter
and are typically cheaply read using anEventReader
. - First
- Runs first in the schedule.
- Fixed
First - Runs first in the
FixedMain
schedule. - Fixed
Last - The schedule that runs last in
FixedMain
- Fixed
Post Update - The schedule that runs after the
FixedUpdate
schedule, for reacting to changes made in the main update logic. - Fixed
PreUpdate - The schedule that contains logic that must run before
FixedUpdate
. - Fixed
Update - The schedule that contains most gameplay logic.
- Has
- Returns a bool that describes if an entity has the component
T
. - HeadYaw
- Hitbox
- Hitbox, aabb of which is calculated each tick using its position and
Hitbox
. In order to change size of this hitbox you need to changeHitbox
. - Hitbox
Shape - Size of hitbox. The only way to manipulate it without losing it on the next tick is using a marker entity. Marker entity’s hitbox is never updated.
- Ident
- A wrapper around a string type
S
which guarantees the wrapped string is a valid resource identifier. - In
- Wrapper type to mark a
SystemParam
as an input. - Interact
Entity Event - Inventory
- Inventory
Window - A helper to represent the inventory window that the player is currently viewing. Handles dispatching reads to the correct inventory.
- Inventory
Window Mut - A helper to represent the inventory window that the player is currently viewing. Handles dispatching reads/writes to the correct inventory.
- Ip
- Item
Stack - A stack of items in an inventory.
- Jump
With Horse Event - Last
- Runs last in the schedule.
- Layer
Bundle - Convenience
Bundle
for spawning a layer entity with bothChunkLayer
andEntityLayer
components. - Leave
BedEvent - Loaded
Chunk - Local
- A system local
SystemParam
. - Look
- Describes the direction an entity is looking using pitch and yaw angles.
- Main
- The schedule that contains the app logic that is evaluated each tick of
App::update()
. - Mut
- Unique mutable borrow of an entity’s component or of a resource.
- Network
Settings - Settings for
NetworkPlugin
. Note that mutations to these fields have no effect after the plugin is built. - NewClient
Info - Contains information about a new client joining the server.
- NonSend
- Shared borrow of a non-
Send
resource. - NonSend
Mut - Unique borrow of a non-
Send
resource. - Observer
- An
Observer
system. Add thisComponent
to anEntity
to turn it into an “observer”. - OldEntity
Layer Id - The value of
EntityLayerId
from the end of the previous tick. - OldPosition
- The value of
Position
from the end of the previous tick. - OldView
- OldView
Distance - The
ViewDistance
at the end of the previous tick. Automatically updated asViewDistance
is changed. - OnAdd
- Trigger emitted when a component is added to an entity.
- OnInsert
- Trigger emitted when a component is inserted on to to an entity.
- OnRemove
- Trigger emitted when a component is removed from an entity.
- Open
Inventory - Used to indicate that the client with this component is currently viewing an inventory.
- Or
- A filter that tests if any of the given filters apply.
- Parallel
Commands - An alternative to
Commands
that can be used in parallel contexts, such as those inQuery::par_iter
- Param
Set - A collection of potentially conflicting
SystemParam
s allowed by disjoint access. - Player
List - Player
List Entry - Marker component for player list entries.
- Position
- Post
Startup - The schedule that runs once after
Startup
. - Post
Update - The schedule that contains logic that must run after
Update
. For example, synchronizing “local transforms” in a hierarchy to “global” absolute transforms. This enables thePostUpdate
transform-sync system to react to “local transform” changes inUpdate
without theUpdate
systems needing to know about (or add scheduler dependencies for) the “global transform sync system”. - PreStartup
- The schedule that runs before
Startup
. - PreUpdate
- The schedule that contains logic that must run before
Update
. For example, a system that reads raw keyboard input OS events into anEvents
resource. This enables systems inUpdate
to consume the events from theEvents
resource without actually knowing about (or taking a direct scheduler dependency on) the “os-level keyboard event system”. - Properties
- Player properties from the game profile.
- Query
- System parameter that provides selective access to the
Component
data stored in aWorld
. - Query
Builder - Builder struct to create
QueryState
instances at runtime. - Query
State - Provides scoped access to a
World
state according to a givenQueryData
andQueryFilter
. - Ref
- Shared borrow of an entity’s component with access to change detection.
Similar to
Mut
but is immutable and so doesn’t require unique access. - Reflect
Component - A struct used to operate on reflected
Component
trait of a type. - Reflect
From World - A struct used to operate on the reflected
FromWorld
trait of a type. - Reflect
Resource - A struct used to operate on reflected
Resource
of a type. - Removed
Components - A
SystemParam
that yields entities that had theirT
Component
removed or have been despawned with it. - Res
- Shared borrow of a
Resource
. - ResMut
- Unique mutable borrow of a
Resource
. - Respawn
Position - The position and angle that clients will respawn with. Also controls the position that compasses point towards.
- Schedule
- A collection of systems, and the metadata and executor needed to run them in a certain order under certain conditions.
- Schedules
- Resource that stores
Schedule
s mapped toScheduleLabel
s excluding the current runningSchedule
. - Server
- Contains global server state accessible as a
Resource
. - Shared
Network State - Sneak
Event - Spawn
Scene - The schedule that contains scene spawning.
- Sprint
Event - Startup
- The schedule that runs once when the app starts.
- SubApp
- A secondary application with its own
World
. These can run independently of each other. - System
Builder - Builder struct used to construct state for
SystemParam
passed to a system. - Text
- Represents formatted text in Minecraft’s JSON text format.
- Trigger
- Type containing triggered
Event
information for a given run of anObserver
. This contains theEvent
data itself. If it was triggered for a specificEntity
, it includes that as well. - Unique
Id - The universally unique identifier of an entity. Component wrapper for a
Uuid
. - Unloaded
Chunk - Update
- The schedule that contains app logic. Ideally containing anything that must run once per render frame, such as UI.
- Username
- Uuid
- A Universally Unique Identifier (UUID).
- Vec2
- A 2-dimensional vector.
- Vec3
- A 3-dimensional vector.
- View
- View
Distance - Visible
Chunk Layer - A
Component
containing a handle to theChunkLayer
a client can see. - Visible
Entity Layers - A
Component
containing the set ofEntityLayer
s a client can see. All Minecraft entities from all layers in this set are potentially visible to the client. - With
- Filter that selects entities with a component
T
. - Without
- Filter that selects entities without a component
T
. - World
- Stores and exposes operations on entities, components, resources, and their associated metadata.
Enums§
- Advancement
Frame Type - AppExit
- An event that indicates the
App
should exit. If one or more of these are present at the end of an update, the runner will end and (maybe) return control to the caller. - Block
Kind - An enumeration of all block kinds.
- Client
Command - Color
- Text color
- Connection
Mode - Describes how new connections to the server are handled.
- Digging
State - Direction
- Entity
Animation - Entity
Interaction - Entity
Status - Game
Mode - Hand
- Inventory
Kind - Item
Kind - Represents an item from the game
- Jump
With Horse State - Particle
- Prop
Name - Contains all possible block state property names.
- Prop
Value - Contains all possible values that a block property might have.
- Should
Update Events - Controls whether or not the events in an
EventRegistry
should be updated. - Sneak
State - Sprint
State
Traits§
- Bundle
- The
Bundle
trait enables insertion and removal ofComponent
s from an entity. - Chunk
- Common operations on chunks. Notable implementors are
LoadedChunk
andUnloadedChunk
. - Component
- A data type that can be used to store data for an entity.
- Condition
- A system that determines if one or more scheduled systems should run.
- Detect
Changes - Types that can read change detection information.
This change detection is controlled by
DetectChangesMut
types such asResMut
. - Detect
Changes Mut - Types that implement reliable change detection.
- Entity
Mapper - An implementor of this trait knows how to map an
Entity
into anotherEntity
. - Event
- Something that “happens” and might be read / observed by app logic.
- From
World - Creates an instance of the type this trait is implemented for
using data from the supplied
World
. - Into
System - Conversion trait to turn something into a
System
. - Into
System Configs - Types that can convert into a
SystemConfigs
. - Into
System Set - Types that can be converted into a
SystemSet
. - Into
System SetConfigs - Types that can convert into a
SystemSetConfigs
. - Into
Text - Trait for any data that can be converted to a
Text
object. - Network
Callbacks - This trait uses
async_trait
. - Plugin
- A collection of Bevy app logic and configuration.
- Plugin
Group - Combines multiple
Plugin
s into a single unit. - Read
Only System System
types that do not modify theWorld
when run. This is implemented for any systems whose parameters all implementReadOnlySystemParam
.- Resource
- A type that can be inserted into a
World
as a singleton. - System
- An ECS system that can be added to a
Schedule
- System
Param Function - A trait implemented for all functions that can be used as
System
s. - System
Set - Types that identify logical groups of systems.
Functions§
- any_
component_ removed - Generates a
Condition
-satisfying closure that returnstrue
if there are any entity with a component of the given type removed. - any_
with_ component - A
Condition
-satisfying system that returnstrue
if there are any entities with the given component type. - apply_
deferred - Instructs the executor to call
System::apply_deferred
on the systems that have run but not applied theirDeferred
system parameters (likeCommands
) or other system buffers. - despawn_
disconnected_ clients - A system for adding
Despawned
components to disconnected clients. This works by listening for removedClient
components. - not
- Generates a
Condition
that inverses the result of passed one. - on_
event - Generates a
Condition
-satisfying closure that returnstrue
if there are any new events of the given type since it was last called. - resource_
added - A
Condition
-satisfying system that returnstrue
if the resource of the given type has been added since the condition was last checked. - resource_
changed - A
Condition
-satisfying system that returnstrue
if the resource of the given type has had its value changed since the condition was last checked. - resource_
changed_ or_ removed - Generates a
Condition
-satisfying closure that returnstrue
if the resource of the given type has had its value changed since the condition was last checked. - resource_
equals - Generates a
Condition
-satisfying closure that returnstrue
if the resource is equal tovalue
. - resource_
exists - A
Condition
-satisfying system that returnstrue
if the resource exists. - resource_
exists_ and_ changed - A
Condition
-satisfying system that returnstrue
if the resource of the given type has had its value changed since the condition was last checked. - resource_
exists_ and_ equals - Generates a
Condition
-satisfying closure that returnstrue
if the resource exists and is equal tovalue
. - resource_
removed - Generates a
Condition
-satisfying closure that returnstrue
if the resource of the given type has been removed since the condition was last checked. - run_
once - Generates a
Condition
-satisfying closure that returnstrue
if the first time the condition is run and false every time after