use of net.countercraft.movecraft.util.hitboxes.SetHitBox in project Movecraft by APDevTeam.
the class TreeHitBoxTest method testContains.
@Test
public void testContains() {
SetHitBox box = new SetHitBox();
box.add(new MovecraftLocation(0, 1, 0));
assertTrue(box.contains(new MovecraftLocation(0, 1, 0)));
}
use of net.countercraft.movecraft.util.hitboxes.SetHitBox in project Movecraft by APDevTeam.
the class TreeHitBoxTest method testIncrementalIterator.
@Test
public void testIncrementalIterator() {
Set<MovecraftLocation> visited = new HashSet<>();
SetHitBox box = new SetHitBox();
for (var location : new SolidHitBox(new MovecraftLocation(-3, -3, -3), new MovecraftLocation(3, 3, 3))) {
box.add(location);
visited.add(location);
Set<MovecraftLocation> verified = new HashSet<>();
for (var probe : box) {
assertTrue(visited.contains(probe), String.format("Location %s is not contained in %s, however %s are", probe, visited, verified));
verified.add(probe);
}
}
}
use of net.countercraft.movecraft.util.hitboxes.SetHitBox in project Movecraft by APDevTeam.
the class TreeHitBoxTest method testCloneBounds.
@Test
public void testCloneBounds() {
SolidHitBox solid = new SolidHitBox(new MovecraftLocation(-3, -3, -3), new MovecraftLocation(3, 3, 3));
SetHitBox box = new SetHitBox(solid);
assertEquals(-3, box.getMinX(), "X");
assertEquals(-3, box.getMinY(), "Y");
assertEquals(-3, box.getMinZ(), "Z");
assertEquals(3, box.getMaxX());
assertEquals(3, box.getMaxY());
assertEquals(3, box.getMaxZ());
}
Aggregations