use of com.builtbroken.mc.lib.world.map.data.s.ChunkDataShort in project Engine by VoltzEngine-Project.
the class ExtendedBlockDataMap method setValue.
/**
* Sets the extended data value
*
* @param x - location in the world
* @param y - location in the world
* @param z - location in the world
* @param value - new data
* @return old data
*/
public short setValue(int x, int y, int z, short value) {
ChunkDataShort chunk = getChunkFromBlockCoords(x, z);
if (chunk != null) {
short prev = chunk.getValue(x & 15, y, z & 15);
chunk.setValue(x & 15, y, z & 15, value);
return prev;
} else {
chunk = add(new ChunkDataShort(x >> 4, z >> 4));
chunk.setValue(x & 15, y, z & 15, value);
}
return 0;
}
use of com.builtbroken.mc.lib.world.map.data.s.ChunkDataShort in project Engine by VoltzEngine-Project.
the class TestChunkDataShort method testAllSlots.
@Test
public void testAllSlots() {
//Test that every slot works
ChunkDataShort chunk = new ChunkDataShort(10, 13);
for (int x = 0; x < 16; x++) {
for (int y = 0; y < 256; y++) {
for (int z = 0; z < 16; z++) {
int r = MathHelper.randomShort();
chunk.setValue(x, y, z, r);
assertEquals(r, chunk.getValue(x, y, z));
}
}
}
}
Aggregations