Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement FakeWorld.getEntities() #312

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/test/java/nova/testutils/FakeWorld.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;

/**
* @author Calclavia
Expand Down Expand Up @@ -90,9 +91,9 @@ public Entity addEntity(EntityFactory factory) {
}

@Override
public Optional<Entity> getEntity(String UUID) {
public Optional<Entity> getEntity(String uniqueID) {
return entities.stream()
.filter(entity -> entity.getUniqueID().equals(UUID))
.filter(entity -> entity.getUniqueID().equals(uniqueID))
.findAny();
}

Expand Down Expand Up @@ -121,8 +122,9 @@ public void removeEntity(Entity entity) {

@Override
public Set<Entity> getEntities(Cuboid bound) {
//TODO: Implement
return null;
return entities.stream()
.filter(entity -> bound.intersects(entity.position()))
.collect(Collectors.toSet());
}

@Override
Expand Down