Search in sources :

Example 6 with BlockFaceSet

use of com.bergerkiller.bukkit.common.collections.BlockFaceSet in project BKCommonLib by bergerhealer.

the class BlockFaceSetTest method testFaceGettersSetters.

private void testFaceGettersSetters(BlockFaceSet initial, boolean north, boolean east, boolean south, boolean west, boolean up, boolean down) {
    // Set them all
    BlockFaceSet set = initial;
    set = set.set(BlockFace.NORTH, north);
    set = set.set(BlockFace.EAST, east);
    set = set.set(BlockFace.SOUTH, south);
    set = set.set(BlockFace.WEST, west);
    set = set.set(BlockFace.UP, up);
    set = set.set(BlockFace.DOWN, down);
    // Check get() equals
    assertEquals(north, set.get(BlockFace.NORTH));
    assertEquals(east, set.get(BlockFace.EAST));
    assertEquals(south, set.get(BlockFace.SOUTH));
    assertEquals(west, set.get(BlockFace.WEST));
    assertEquals(up, set.get(BlockFace.UP));
    assertEquals(down, set.get(BlockFace.DOWN));
    // Check face properties equals
    assertEquals(north, set.north());
    assertEquals(east, set.east());
    assertEquals(south, set.south());
    assertEquals(west, set.west());
    assertEquals(up, set.up());
    assertEquals(down, set.down());
}
Also used : BlockFaceSet(com.bergerkiller.bukkit.common.collections.BlockFaceSet)

Example 7 with BlockFaceSet

use of com.bergerkiller.bukkit.common.collections.BlockFaceSet in project BKCommonLib by bergerhealer.

the class BlockFaceSetTest method testByMask.

@Test
public void testByMask() {
    for (int i = 0; i < 64; i++) {
        BlockFaceSet set = BlockFaceSet.byMask(i);
        assertEquals(i, set.mask());
        assertEquals((i & BlockFaceSet.MASK_NORTH) != 0, set.north());
        assertEquals((i & BlockFaceSet.MASK_EAST) != 0, set.east());
        assertEquals((i & BlockFaceSet.MASK_SOUTH) != 0, set.south());
        assertEquals((i & BlockFaceSet.MASK_WEST) != 0, set.west());
        assertEquals((i & BlockFaceSet.MASK_UP) != 0, set.up());
        assertEquals((i & BlockFaceSet.MASK_DOWN) != 0, set.down());
    }
}
Also used : BlockFaceSet(com.bergerkiller.bukkit.common.collections.BlockFaceSet) Test(org.junit.Test)

Aggregations

BlockFaceSet (com.bergerkiller.bukkit.common.collections.BlockFaceSet)7 Test (org.junit.Test)3 BlockFace (org.bukkit.block.BlockFace)2