-
Notifications
You must be signed in to change notification settings - Fork 114
Singleton marker type component
Daan van Yperen edited this page Sep 29, 2015
·
1 revision
Sometimes it can be useful to assign tag-type components - components with no data other than belonging to an entity.
If the project is setup with the maven plugin or when using the CLI, the easiest way is using @PackedWeaver
on a component with no fields, thereby ensuring there will only ever be one instance of the component.
@PackedWeaver
public class SingletonComponent extends Component {}
The above code is equivalent to:
public class SingletonComponent extends PackedComponent {
@Override
protected void forEntity(Entity e) {}
@Override
protected void ensureCapacity(int id) {}
@Override
protected void reset() {}
}
- Overview
- Concepts
- Getting Started
- Using
- More guides
- Plugins
- Game Gallery
- Tools and Frameworks
- API reference