Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion content/docs/en/guides/ecs/example-ecs-plugin.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public class PoisonComponent implements Component<EntityStore> {
}

// A builder codec is needed to allow components to be saved and loaded from disk
// NOTE: You must specify the codec when registering the component for it to save and load data.
public static final BuilderCodec<PoisonComponent> CODEC = BuilderCodec
.builder(PoisonComponent.class, PoisonComponent::new)
.append(
Expand Down Expand Up @@ -230,7 +231,7 @@ public final class ExamplePlugin extends JavaPlugin {

// Register the component & set the type in the component class so its easier to retrieve.
ComponentType<EntityStore, PoisonComponent> poisonComponentType = this.getEntityStoreRegistry()
.registerComponent(PoisonComponent.class, PoisonComponent::new);
.registerComponent(PoisonComponent.class, PoisonComponent::new, PoisonComponent.CODEC);
PoisonComponent.setComponentType(poisonComponentType);

this.getEntityStoreRegistry().registerSystem(new PoisonSystem(PoisonComponent.getComponentType()));
Expand Down