use of io.xol.chunkstories.api.world.chunk.Chunk in project chunkstories by Hugobros3.
the class WorldImplementation method peek.
@Override
public /**
* Fancy get method that throws exceptions when the world isn't loaded
*/
ChunkCell peek(int x, int y, int z) throws WorldException {
x = sanitizeHorizontalCoordinate(x);
y = sanitizeVerticalCoordinate(y);
z = sanitizeHorizontalCoordinate(z);
Region region = this.getRegionWorldCoordinates(x, y, z);
if (region == null)
throw new RegionNotLoadedException(this, x / 256, y / 256, z / 256);
Chunk chunk = region.getChunk((x / 32) % 8, (y / 32) % 8, (z / 32) % 8);
if (chunk == null)
throw new ChunkNotLoadedException(region, (x / 32) % 8, (y / 32) % 8, (z / 32) % 8);
return chunk.peek(x, y, z);
}
use of io.xol.chunkstories.api.world.chunk.Chunk in project chunkstories by Hugobros3.
the class WorldImplementation method pokeSimple.
@Override
public void pokeSimple(int x, int y, int z, Voxel voxel, int sunlight, int blocklight, int metadata) {
x = sanitizeHorizontalCoordinate(x);
y = sanitizeVerticalCoordinate(y);
z = sanitizeHorizontalCoordinate(z);
Chunk chunk = this.getChunkWorldCoordinates(x, y, z);
if (chunk != null)
chunk.pokeSimple(x, y, z, voxel, sunlight, blocklight, metadata);
}
use of io.xol.chunkstories.api.world.chunk.Chunk in project chunkstories by Hugobros3.
the class WorldImplementation method peekRaw.
@Override
public int peekRaw(int x, int y, int z) {
x = sanitizeHorizontalCoordinate(x);
y = sanitizeVerticalCoordinate(y);
z = sanitizeHorizontalCoordinate(z);
Chunk chunk = this.getChunkWorldCoordinates(x, y, z);
if (chunk == null)
return 0x00000000;
else
return chunk.peekRaw(x, y, z);
}
use of io.xol.chunkstories.api.world.chunk.Chunk in project chunkstories by Hugobros3.
the class WorldImplementation method redrawEverything.
@Override
public synchronized // TODO move to client
void redrawEverything() {
ChunksIterator i = this.getAllLoadedChunks();
Chunk c;
while (i.hasNext()) {
c = i.next();
if (c instanceof ChunkRenderable) {
ChunkRenderable c2 = (ChunkRenderable) c;
c2.lightBaker().requestLightningUpdate();
c2.meshUpdater().requestMeshUpdate();
}
}
}
use of io.xol.chunkstories.api.world.chunk.Chunk in project chunkstories by Hugobros3.
the class WorldImplementation method pokeSimpleSilently.
@Override
public void pokeSimpleSilently(int x, int y, int z, Voxel voxel, int sunlight, int blocklight, int metadata) {
x = sanitizeHorizontalCoordinate(x);
y = sanitizeVerticalCoordinate(y);
z = sanitizeHorizontalCoordinate(z);
Chunk chunk = this.getChunkWorldCoordinates(x, y, z);
if (chunk != null)
chunk.pokeSimpleSilently(x, y, z, voxel, sunlight, blocklight, metadata);
}
Aggregations