Skip to main content

Module prelude

Module prelude 

Source
Expand description

Contains the most frequently used items in ChunkEdge projects.

This is usually glob imported like so:

use chunkedge::prelude::*; // Glob import.

let mut app = App::empty();
app.add_systems(Update, || println!("yippee!"));
app.update()
// ...

Re-exports§

pub use chunkedge_server::message::SendMessage as _;
pub use chunkedge_server::title::SetTitle as _;
pub use super::DefaultPlugins;
pub use bevy_ecs;
pub use chunkedge_server::ident;

Macros§

children
Returns a SpawnRelatedBundle that will insert the Children component, spawn a SpawnableList of entities with given bundles that relate to the Children entity via the ChildOf component, and reserve space in the Children for each spawned entity.
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.
related
Returns a SpawnRelatedBundle that will insert the given RelationshipTarget, spawn a SpawnableList of entities with given bundles that relate to the RelationshipTarget entity via the RelationshipTarget::Relationship component, and reserve space in the RelationshipTarget for each spawned entity.

Structs§

Add
Trigger emitted when a component is inserted onto an entity that does not already have that component. Runs before Insert. See ComponentHooks::on_add for more information.
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.
AdvancementBundle
Components for advancement that are required Optional components: AdvancementDisplay ChildOf - parent advancement
AdvancementClientUpdate
AdvancementCriteria
Criteria’s identifier. May not be updated
AdvancementDisplay
Advancement display. Optional component
AdvancementRequirements
Requirements for advancement to be completed. All columns should be completed, column is completed when any of criteria in this column is completed.
AdvancementTabChangeMessage
This message sends when the client changes or closes advancement’s tab.
Allow
Allows a query to contain entities with the component T, bypassing DefaultQueryFilters.
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.
AppTypeRegistry
A Resource storing [TypeRegistry] for type registrations relevant to a whole app.
ApplyDeferred
A special System that instructs the executor to call System::apply_deferred on the systems that have run but not applied their Deferred system parameters (like Commands) or other system buffers.
BevyError
The built in “universal” Bevy error type. This has a blanket From impl for any type that implements Rust’s Error, meaning it can be used as a “catch all” error.
Biome
BiomeId
BiomeRegistry
Block
Represents a complete block, which is a pair of block state and optional NBT data for the block entity.
BlockPos
Represents an absolute block position in world space.
BlockRef
Like Block, but immutably referenced.
BlockState
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.
ChildOf
Stores the parent entity of this child entity with this component.
Children
Tracks which entities are children of this parent entity.
ChunkLayer
A Component containing the chunks and dimension information of a Minecraft world.
ChunkPos
The X and Z position of a chunk.
ChunkView
Represents the set of all chunk positions that a client can see, defined by a center chunk position pos and view distance dist.
Client
The main client component. Contains the underlying network connection and packet buffer.
ClientSpawnQuery
A convenient QueryData for obtaining client spawn components. Also see ClientSpawnQueryReadOnly.
ClientSpawnQueryReadOnly
Automatically generated WorldQuery type for a read-only variant of ClientSpawnQuery.
Commands
A Command queue to perform structural changes to the World.
Compound
A map type with String keys and Value values.
ContiguousMut
Data type returned by ContiguousQueryData::fetch_contiguous for Mut<T> and &mut T
ContiguousRef
Contiguous equivalent of Ref<T>.
CursorItem
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 the World during ApplyDeferred. This is used internally by Commands to defer World mutations.
Despawn
EntityEvent emitted for each component on an entity when it is despawned. See ComponentHooks::on_despawn for more information.
Despawned
A marker Component for entities that should be despawned at the end of the tick.
DiggingMessage
DimensionType
DimensionTypeRegistry
Discard
Trigger emitted when a component is removed from an entity, regardless of whether or not it is later replaced.
Entity
Unique identifier for an entity in a World. Note that this is just an id, not the entity itself. Further, the entity this id refers to may no longer exist in the World. For more information about entities, their ids, and how to use them, see the module docs.
EntityCommands
A list of commands that will be run to modify an Entity.
EntityKind
Identifies the type of an entity. As a component, the entity kind should not be modified.
EntityLayer
A Component containing Minecraft entities.
EntityLayerId
Contains the entity layer an entity is on.
EntityManager
A Resource which maintains information about all spawned Minecraft entities.
EntityMut
Provides mutable access to a single entity and all of its components.
EntityRef
A read-only reference to a particular Entity and all of its components.
EntityWorldMut
A mutable reference to a particular Entity, and the entire world.
Equipment
Contains the visible equipment of a LivingEntity, such as armor and held items. By default this is not synced with a player’s chunkedge_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 the EquipmentInventorySync component to the player entity to sync the equipment with the inventory.
ErasedNetworkCallbacks
A type-erased wrapper around an NetworkCallbacks object.
EventLoopPostUpdate
EventLoopPreUpdate
EventLoopUpdate
FilteredResources
Provides read-only access to a set of Resources defined by the contained Access.
FilteredResourcesMut
Provides mutable access to a set of Resources defined by the contained Access.
First
Runs first in the schedule.
FixedFirst
Runs first in the FixedMain schedule.
FixedLast
The schedule that runs last in FixedMain
FixedPostUpdate
The schedule that runs after the FixedUpdate schedule, for reacting to changes made in the main update logic.
FixedPreUpdate
The schedule that contains logic that must run before FixedUpdate.
FixedUpdate
The schedule that contains most gameplay logic, which runs at a fixed rate rather than every render frame. For logic that should run once per render frame, use the Update schedule instead.
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 change Hitbox.
HitboxShape
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.
If
A SystemParam that wraps another parameter and causes its system to skip instead of failing when the parameter is invalid.
In
A SystemInput type which denotes that a System receives an input value of type T from its caller.
InMut
A SystemInput type which denotes that a System receives a mutable reference to a value of type T from its caller.
InRef
A SystemInput type which denotes that a System receives a read-only reference to a value of type T from its caller.
Insert
Trigger emitted when a component is inserted, regardless of whether or not the entity already had that component. Runs after Add, if it ran. See ComponentHooks::on_insert for more information.
InteractEntityMessage
Inventory
InventoryWindow
A helper to represent the inventory window that the player is currently viewing. Handles dispatching reads to the correct inventory.
InventoryWindowMut
A helper to represent the inventory window that the player is currently viewing. Handles dispatching reads/writes to the correct inventory.
Ip
ItemStack
A stack of items in an inventory.
JumpWithHorseMessage
Last
Runs last in the schedule.
LayerBundle
Convenience Bundle for spawning a layer entity with both ChunkLayer and EntityLayer components.
LeaveBedMessage
LoadedChunk
Local
A SystemParam that provides a system-private value of T that persists across system calls.
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().
MessageMutator
Reads and writes Messages of type T, keeping track of which messages have already been read.
MessageReader
Reads Messages of type T in order and tracks which messages have already been read.
MessageWriter
Writes Messages of type T.
Messages
A message collection that represents the messages that occurred within the last two Messages::update calls. Messages can be written to using a MessageWriter and are typically cheaply read using a MessageReader.
Mut
Unique mutable borrow of an entity’s component or of a resource.
Name
Component used to identify an entity. Stores a hash for faster comparisons.
NameOrEntity
Convenient query for giving a human friendly name to an entity.
NetworkSettings
Settings for NetworkPlugin. Note that mutations to these fields have no effect after the plugin is built.
NewClientInfo
Contains information about a new client joining the server.
NonSend
Shared borrow of a non-Send resource.
NonSendMut
Unique borrow of a non-Send resource.
Observer
An Observer system. Add this Component to an Entity to turn it into an “observer”.
OldEntityLayerId
The value of EntityLayerId from the end of the previous tick.
OldPosition
The value of Position from the end of the previous tick.
OldView
OldViewDistance
The ViewDistance at the end of the previous tick. Automatically updated as ViewDistance is changed.
On
A system parameter used by an observer to process events. See Observer and Event for examples.
OpenInventory
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.
ParallelCommands
An alternative to Commands that can be used in parallel contexts, such as those in Query::par_iter.
ParamSet
A collection of potentially conflicting SystemParams allowed by disjoint access.
Passengers
Automatically maintained on a vehicle entity; lists the entities currently riding it.
PlayerList
PlayerListEntry
Marker component for player list entries.
Populated
System parameter that works very much like Query except it always contains at least one matching entity.
PopulatedMessageReader
Reads Messages of type T in order and tracks which messages have already been read. Skips the system if there no messages.
Position
PostStartup
The schedule that runs once after Startup.
PostUpdate
The schedule that contains logic that must run after Update. For example, synchronizing “local transforms” in a hierarchy to “global” absolute transforms. This enables the PostUpdate transform-sync system to react to “local transform” changes in Update without the Update 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 a Messages resource. This enables systems in Update to consume the messages from the Messages 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
A system parameter that provides selective access to the Component data stored in a World.
QueryBuilder
Builder struct to create QueryState instances at runtime.
QueryState
Provides scoped access to a World state according to a given QueryData and QueryFilter.
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.
ReflectComponent
A struct used to operate on reflected Component trait of a type.
ReflectEvent
A struct used to operate on reflected Event trait of a type.
ReflectFromWorld
A struct used to operate on the reflected FromWorld trait of a type.
ReflectMessage
A struct used to operate on reflected Message trait of a type.
ReflectResource
A struct that marks a reflected Resource of a type.
RegistryId
Remove
Trigger emitted when a component is removed from an entity, and runs before the component is removed, so you can still access the component data. See ComponentHooks::on_remove for more information.
RemovedComponents
A SystemParam that yields entities that had their T Component removed or have been despawned with it.
Res
Shared borrow of a Resource.
ResMut
Unique mutable borrow of a Resource.
RespawnPosition
The position and angle that clients will respawn with. Also controls the position that compasses point towards.
Riding
Placed on a passenger entity, pointing at the vehicle it rides.
RunFixedMainLoop
Runs the FixedMain schedule in a loop according until all relevant elapsed time has been “consumed”.
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 Schedules mapped to ScheduleLabels excluding the current running Schedule.
Server
Contains global server state accessible as a Resource.
SharedNetworkState
Single
System parameter that provides access to single entity’s components, much like Query::single/Query::single_mut.
SneakMessage
Spawn
A wrapper over a Bundle indicating that an entity should be spawned with that Bundle. This is intended to be used for hierarchical spawning via traits like SpawnableList and SpawnRelated.
SpawnIter
A SpawnableList that spawns entities using an iterator of a given Bundle:
SpawnScene
The schedule that contains scene spawning.
SpawnWith
A SpawnableList that spawns entities using a FnOnce with a RelatedSpawner as an argument:
SprintMessage
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.
TaskPoolOptions
Helper for configuring and creating the default task pools. For end-users who want full control, set up TaskPoolPlugin
TaskPoolPlugin
Setup of default task pools: [AsyncComputeTaskPool], [ComputeTaskPool], [IoTaskPool].
Text
Represents formatted text in Minecraft’s JSON text format.
UniqueId
The universally unique identifier of an entity. Component wrapper for a Uuid.
UnloadedChunk
Update
The schedule that contains any app logic that must run once per render frame. For most gameplay logic, consider using FixedUpdate instead.
Username
Uuid
A Universally Unique Identifier (UUID).
Vec2
A 2-dimensional vector.
Vec3
A 3-dimensional vector.
View
ViewDistance
VisibleChunkLayer
A Component containing a handle to the ChunkLayer a client can see.
VisibleEntityLayers
A Component containing the set of EntityLayers 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.
WithOneRelated
A wrapper over an Entity indicating that an entity should be added. This is intended to be used for hierarchical spawning via traits like SpawnableList and SpawnRelated.
WithRelated
A SpawnableList that links already spawned entities to the root entity via relations of type I.
Without
Filter that selects entities without a component T.
World
Stores and exposes operations on entities, components, resources, and their associated metadata.

Enums§

AdvancementFrameType
AppExit
A Message 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.
BlockKind
An enumeration of all block kinds.
Color
Text color
ConnectionMode
Describes how new connections to the server are handled.
DiggingState
Direction
EntityAnimation
EntityInteraction
EntityStatus
GameMode
Hand
InventoryKind
ItemKind
Represents an item from the game
JumpWithHorseState
Particle
PlayerCommand
PropName
Contains all possible block state property names.
PropValue
Contains all possible values that a block property might have.
RunFixedMainLoopSystems
Set enum for the systems that want to run inside RunFixedMainLoop, but before or after the fixed update logic. Systems in this set will run exactly once per frame, regardless of the number of fixed updates. They will also run under a variable timestep.
Severity
Indicates how severe a BevyError is.
SneakState
SprintState

Traits§

Bundle
The Bundle trait enables insertion and removal of Components from an entity.
Chunk
Common operations on chunks. Notable implementors are LoadedChunk and UnloadedChunk.
Command
A World mutation.
Component
A data type that can be used to store data for an entity.
ContainsEntity
A trait for types that contain an Entity.
DetectChanges
Types that can read change detection information. This change detection is controlled by DetectChangesMut types such as ResMut.
DetectChangesMut
Types that implement reliable change detection.
EntityCommand
A command which gets executed for a given Entity.
EntityEvent
An EntityEvent is an Event that is triggered for a specific EntityEvent::event_target entity:
EntityMapper
An implementor of this trait knows how to map an Entity into another Entity.
Event
An Event is something that “happens” at a given moment.
FromTemplate
FromTemplate is implemented for types that can be produced by a specific, canonical Template. This creates a way to correlate to the Template using the desired template output type. This is used by Bevy’s scene system.
FromWorld
Creates an instance of the type this trait is implemented for using data from the supplied World.
IntoScheduleConfigs
Types that can convert into a ScheduleConfigs.
IntoSystem
Conversion trait to turn something into a System.
IntoSystemSet
Types that can be converted into a SystemSet.
IntoText
Trait for any data that can be converted to a Text object.
Message
A buffered message for pull-based event handling.
NetworkCallbacks
This trait uses async_trait.
ObserverSystemExt
Extension trait for adding run conditions to observer systems.
Plugin
A collection of Bevy app logic and configuration.
PluginGroup
Combines multiple Plugins into a single unit.
ReadOnlySystem
System types that do not modify the World when run. This is implemented for any systems whose parameters all implement ReadOnlySystemParam.
RelationshipTarget
A Component containing the collection of entities that relate to this Entity via the associated Relationship type. See the Relationship documentation for more information.
Resource
A type that can be inserted into a World as a singleton.
ResultSeverityExt
Extension methods for annotating errors with a Severity.
SpawnRelated
RelationshipTarget methods that create a Bundle with a DynamicBundle::Effect that:
System
An ECS system that can be added to a Schedule
SystemCondition
A system that determines if one or more scheduled systems should run.
SystemInput
Trait for types that can be used as input to Systems.
SystemParamBuilder
A builder that can create a SystemParam.
SystemParamFunction
A trait implemented for all functions that can be used as Systems.
SystemSet
System sets are tag-like labels that can be used to group systems together.
Template
A Template is something that, given a spawn context (target Entity, World, etc), can produce a Template::Output.

Functions§

any_component_removed
A SystemCondition-satisfying system that returns true if there are any entity with a component of the given type removed.
any_match_filter
A SystemCondition-satisfying system that returns true if there are any entities that match the given QueryFilter.
any_with_component
A SystemCondition-satisfying system that returns true if there are any entities with the given component type.
condition_changed
Generates a SystemCondition that returns true when the passed one changes.
condition_changed_to
Generates a SystemCondition that returns true when the result of the passed one went from false to true since the last time this was called.
despawn_disconnected_clients
A system for adding Despawned components to disconnected clients. This works by listening for removed Client components.
not
Generates a SystemCondition that inverses the result of passed one.
on_message
A SystemCondition-satisfying system that returns true if there are any new messages of the given type since it was last called.
resource_added
A SystemCondition-satisfying system that returns true if the resource of the given type has been added since the condition was last checked.
resource_changed
A SystemCondition-satisfying system that returns true if the resource of the given type has been added or mutably dereferenced since the condition was last checked.
resource_changed_or_removed
A SystemCondition-satisfying system that returns true if the resource of the given type has been added, removed or mutably dereferenced since the condition was last checked.
resource_equals
Generates a SystemCondition-satisfying closure that returns true if the resource is equal to value.
resource_exists
A SystemCondition-satisfying system that returns true if the resource exists.
resource_exists_and_changed
A SystemCondition-satisfying system that returns true if the resource of the given type has been added or mutably dereferenced since the condition was last checked.
resource_exists_and_equals
Generates a SystemCondition-satisfying closure that returns true if the resource exists and is equal to value.
resource_removed
A SystemCondition-satisfying system that returns true if the resource of the given type has been removed since the condition was last checked.
run_once
A SystemCondition-satisfying system that returns true on the first time the condition is run and false every time after.
template
Returns a “free floating” template for a given func. This prevents the need to define a custom type for one-off templates.

Type Aliases§

ChildSpawner
A type alias over RelatedSpawner used to spawn child entities containing a ChildOf relationship.
ChildSpawnerCommands
A type alias over RelatedSpawnerCommands used to spawn child entities containing a ChildOf relationship.
Result
A result type for use in fallible systems, commands and observers.
SystemIn
Shorthand way to get the System::In for a System as a SystemInput::Inner.

Derive Macros§

Bundle
Implement the Bundle trait.
Component
Cheat sheet for derive syntax, see full explanation and examples on the Component trait doc.
EntityEvent
Cheat sheet for derive syntax, see full explanation on EntityEvent trait docs.
Event
Implement the Event trait.
FromTemplate
Derives FromTemplate.
FromWorld
Implement the FromWorld trait.
Message
Implement the Message trait.
Resource
Implement the Resource trait.
SystemSet
Derive macro generating an impl of the trait SystemSet.