Analogies to this can be found in SpaceEngineers or Minecraft, which are C# and Java respectively:
SpaceEngineers:
Code: Select all
GridTerminalSystem.GetBlocksOfType<IMyTextPanel>(displays, b => b.CubeGrid == Me.CubeGrid && isBatteryDisplay(b.CustomName));
Minecraft:
Code: Select all
world.selectEntitiesWithinAABB(Class p_82733_1_, AxisAlignedBB p_82733_2_, IEntitySelector p_82733_3_)
-------------
List list = this.worldObj.selectEntitiesWithinAABB(EntityChicken.class, this.boundingBox.expand(5.0D, 3.0D, 5.0D), IEntitySelector.field_152785_b);
-------------
IEntitySelector field_152785_b = new IEntitySelector()
{
private static final String __OBFID = "CL_00001542";
/**
* Return whether the specified entity is applicable to this filter.
*/
public boolean isEntityApplicable(Entity p_82704_1_)
{
return p_82704_1_.isEntityAlive() && p_82704_1_.riddenByEntity == null && p_82704_1_.ridingEntity == null;
}
};
Sample use case in factorio:
Code: Select all
local function hasHealth(entity)
return entity.health and entity.health > 0
end
local entities = surface.find_entities_filtered(area = box, force = game.forces.enemy, checks = hasHealth)