Skip to content

EntityLinkManager getting started

Adrian Papari edited this page Feb 21, 2017 · 4 revisions

Managed entity references

Setup

  1. Register EntityLinkManager.class with the World/WorldConfiguration.
  2. (Recommended) Setup artemis-odb-plugin to avoid slow reflection calls.

Usage

Components with fields referencing other entities are managed automatically.

@PooledWeaver
public class Anchor extends Component {
    @EntityId public int target = -1; // managed
    public Entity target2; // managed
}

Set target and target2 like you would normally. Whenever the entity referenced by target is removed, it will automatically be set to -1 (or null for Entity).

Clone this wiki locally