package com.jvpichowski.jme3.es.bullet;

import com.jvpichowski.jme3.es.bullet.components.PhysicsInstance;
import com.simsilica.es.ComponentFilter;
import com.simsilica.es.EntityComponent;

/**
 * This system isn't fully integrated. Later it will be possible to have multiple
 * bullet systems which use this filter to determine if the entity belongs to them.
 * As a consequence every subsystem has to use this entity filter.
 */
public final class PhysicsInstanceFilter implements ComponentFilter<PhysicsInstance> {

    private int instance;

    public PhysicsInstanceFilter(int instance) {
        this.instance = instance;
    }

    @Override
    public Class<PhysicsInstance> getComponentType() {
        return PhysicsInstance.class;
    }

    @Override
    public boolean evaluate(EntityComponent c) {
        return ((PhysicsInstance)c).getInstance() == instance;
    }
}

@@ -181,16 +181,87 @@
 mponent;
+%0Aimport com.simsilica.es.EntityData;%0Aimport com.simsilica.es.EntitySet;
 %0A%0A/**%0A *
@@ -945,11 +945,356 @@
 e;%0A    %7D
+%0A%0A    public static EntitySet getEntities(EntityData entityData, PhysicsInstanceFilter filter, Class%3C? extends EntityComponent%3E components)%7B%0A        if(filter == null)%7B%0A            return entityData.getEntities(components);%0A        %7Delse %7B%0A            return entityData.getEntities(filter, filter.getComponentType(), components);%0A        %7D%0A    %7D
 %0A%7D%0A

add helper method to instance filter