2020-07-11 14:16:36 +02:00
|
|
|
package net.minestom.server.utils.entity;
|
|
|
|
|
2020-07-29 22:55:25 +02:00
|
|
|
import net.minestom.server.entity.Entity;
|
2020-07-11 14:16:36 +02:00
|
|
|
import net.minestom.server.entity.EntityType;
|
|
|
|
import net.minestom.server.utils.math.IntRange;
|
|
|
|
|
2020-07-29 22:55:25 +02:00
|
|
|
import java.util.ArrayList;
|
2020-12-28 20:57:39 +01:00
|
|
|
import java.util.List;
|
2020-07-29 22:55:25 +02:00
|
|
|
|
2020-10-17 13:24:18 +02:00
|
|
|
// TODO
|
|
|
|
|
2020-07-11 14:16:36 +02:00
|
|
|
/**
|
2020-10-17 13:24:18 +02:00
|
|
|
* Represents a query which can be call to find one or multiple entities.
|
|
|
|
* It is based on the target selectors used in commands.
|
2020-07-11 14:16:36 +02:00
|
|
|
*/
|
|
|
|
public class EntityFinder {
|
|
|
|
|
|
|
|
// Commands option
|
|
|
|
private boolean onlySingleEntity;
|
|
|
|
private boolean onlyPlayers;
|
|
|
|
|
|
|
|
// Simple float
|
|
|
|
private float x, y, z;
|
|
|
|
private float dx, dy, dz;
|
|
|
|
|
|
|
|
// Range
|
|
|
|
private IntRange distance;
|
|
|
|
private IntRange level;
|
|
|
|
|
|
|
|
// By traits
|
|
|
|
private int limit;
|
|
|
|
private EntitySort entitySort;
|
|
|
|
private EntityType entityType;
|
|
|
|
|
|
|
|
public boolean isOnlySingleEntity() {
|
|
|
|
return onlySingleEntity;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setOnlySingleEntity(boolean onlySingleEntity) {
|
|
|
|
this.onlySingleEntity = onlySingleEntity;
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean isOnlyPlayers() {
|
|
|
|
return onlyPlayers;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setOnlyPlayers(boolean onlyPlayers) {
|
|
|
|
this.onlyPlayers = onlyPlayers;
|
|
|
|
}
|
|
|
|
|
2020-07-29 22:55:25 +02:00
|
|
|
/**
|
|
|
|
* Find a list of entities (could be empty) based on the conditions
|
|
|
|
*
|
|
|
|
* @return all entities validating the conditions
|
|
|
|
*/
|
2020-12-28 20:57:39 +01:00
|
|
|
public List<Entity> find() {
|
2020-07-29 22:55:25 +02:00
|
|
|
return new ArrayList<>();
|
|
|
|
}
|
|
|
|
|
2020-07-11 14:16:36 +02:00
|
|
|
public enum EntitySort {
|
|
|
|
ARBITRARY, FURTHEST, NEAREST, RANDOM
|
|
|
|
}
|
|
|
|
}
|