Class ScopedPositionProvider

All Implemented Interfaces:
InfoProvider, IPositionProvider

public class ScopedPositionProvider extends PositionProvider
A raw PositionProvider that also carries an optional associated entity, decoupling the position from the entity. Used by ForEach as the per-element provider so a scoped element can expose a computed position to position leaves while still surfacing the source entity to entity-target leaves and to isolation keying. Orientation (when the element carries one) is held by the inherited PositionProvider.
  • Constructor Details

    • ScopedPositionProvider

      public ScopedPositionProvider()
  • Method Details

    • setEntity

      public void setEntity(@Nullable Ref<EntityStore> entity)
    • clear

      public void clear()
      Description copied from interface: IPositionProvider
      Reset position provider so that hasPosition() will return false.
      Specified by:
      clear in interface IPositionProvider
      Overrides:
      clear in class PositionProvider
    • getTarget

      @Nullable public Ref<EntityStore> getTarget()
      Description copied from interface: IPositionProvider
      Return target entity if sensor provides it currently.

      A sensor might return a valid position but return a null value here if this position does not correlate to an entity.

      Specified by:
      getTarget in interface IPositionProvider
      Overrides:
      getTarget in class PositionProvider
      Returns:
      entity ref if sensor is matching and result refers to an entity, else null.