/** * This entity has changed, a component added or deleted. */ public void changedInWorld() { world.changedEntity(this); }
/** * Remove component by its type. * @param type Type of component to remove. * * @return this entity for chaining. */ public Entity removeComponent(Class<? extends Component> type) { componentManager.removeComponent(this, type); if (isActive()) { world.changedEntity(this); } return this; }
/** * Add a component to this entity. * * @param component to add to this entity * * @return this entity for chaining. */ public Entity addComponent(Component component) { componentManager.addComponent(this, component); if (isActive()) { world.changedEntity(this); } return this; }