The component types a world knows how to write, and which of them the view may read.
Every component type on an entity is registered or excluded. A world refuses to save a component it has no codec for and no reason not to save, naming the type: a field missing from a save file is a bug found hours later, and the moment to hear about it is while writing the save.
add's published flag is the boundary between simulation and
view (item 19). Published components are copied, through their codec,
into the PublishedState built in the publish phase; the view reads
nothing else of the world.
The one way to register a component. A codec carries its id and its
version, and an InPlaceCodec is the form for a component restored into
the instance already there; EcsWorld's own shorthands from before 1.0
(register(name, encode:, decode:), registerInPlace, exclude) are
gone, and the migration guide shows each caller its codec.
- Inheritance
-
- Object
- PluginRegistry
- ComponentRegistry
- Implementers
Constructors
- ComponentRegistry()
-
For the engine's world, which extends this; a plugin is handed one
through its host.
const
Properties
-
companions
→ Iterable<
PluginRegistry> -
The registries that come with this one, found by
PluginHost.registryas if each had been handed to the host itself.no setterinherited - hashCode → int
-
The hash code for this object.
no setterinherited
-
registered
→ List<
ComponentInfo> -
Every registered and excluded type, in registration order.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
add<
T extends Object> (ComponentCodec< T> codec, {bool published = false}) → Registration -
Says how components of type
Tare written down. Throws a NameTakenException whencodec's id is taken by another type. -
codecNamed(
String id) → ComponentCodec< Object> ? -
The codec registered under
id; null when there is none (absent). -
codecOf<
T extends Object> () → ComponentCodec< T> ? -
The codec registered for
T; null when there is none (absent). -
exclude<
T extends Object> (String because) → Registration -
Says that components of type
Tare deliberately not saved, and why: a renderer handle, a cache, anything rebuilt from what is saved. -
forPlugin(
PluginScope scope) → ComponentRegistry -
This registry as
scope's plugin sees it: everything registered through the result is tracked byscope, ranked by it, and checked against its manifest. Must return the same type the registry is looked up by.override -
isPublished<
T extends Object> () → bool -
Whether
Tis registered withpublished: true. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited