use of io.xol.chunkstories.api.exceptions.world.ChunkNotLoadedException 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.exceptions.world.ChunkNotLoadedException in project chunkstories by Hugobros3.
the class WorldImplementation method poke.
@Override
public ChunkCell poke(int x, int y, int z, Voxel voxel, int sunlight, int blocklight, int metadata, WorldModificationCause cause) 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.poke(x, y, z, voxel, sunlight, blocklight, metadata, cause);
}
Aggregations