KubeJS

KubeJS

83M Downloads

Predicate list does not work when more than one predicate

pietro-lopes opened this issue ยท 0 comments

commented

When using @e the first predicate is Entity::isAlive and this test pass in all entities.
The subsequent test are virtually ignored

Minecraft condenses a List of predicate with Util.allOf, that should be done here before starting the entities loop.

public EntityArrayList filter(List<Predicate<Entity>> filterList) {
if (isEmpty() || filterList.isEmpty()) {
return this;
}
var list = new EntityArrayList(size());
for (var entity : this) {
for (var filter : filterList) {
if (filter.test(entity)) {
list.add(entity);
}
}
}
return list;
}