use of io.xol.chunkstories.api.world.chunk.Chunk 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);
}
use of io.xol.chunkstories.api.world.chunk.Chunk in project chunkstories by Hugobros3.
the class WorldImplementation method pokeRaw.
@Override
public void pokeRaw(int x, int y, int z, int raw_data) {
x = sanitizeHorizontalCoordinate(x);
y = sanitizeVerticalCoordinate(y);
z = sanitizeHorizontalCoordinate(z);
Chunk chunk = this.getChunkWorldCoordinates(x, y, z);
if (chunk != null)
chunk.pokeRaw(x, y, z, raw_data);
}
use of io.xol.chunkstories.api.world.chunk.Chunk in project chunkstories by Hugobros3.
the class WorldImplementation method peekSafely.
@Override
public WorldCell peekSafely(int x, int y, int z) {
x = sanitizeHorizontalCoordinate(x);
y = sanitizeVerticalCoordinate(y);
z = sanitizeHorizontalCoordinate(z);
Region region = this.getRegionWorldCoordinates(x, y, z);
if (region == null) {
return new UnloadedWorldCell(x, y, z, this.getGameContext().getContent().voxels().air(), 0, 0, 0);
}
Chunk chunk = region.getChunk((x / 32) % 8, (y / 32) % 8, (z / 32) % 8);
if (chunk == null)
return new UnloadedWorldCell(x, y, z, this.getGameContext().getContent().voxels().air(), 0, 0, 0);
return chunk.peek(x, y, z);
}
use of io.xol.chunkstories.api.world.chunk.Chunk in project chunkstories by Hugobros3.
the class WorldImplementation method pokeRawSilently.
@Override
public void pokeRawSilently(int x, int y, int z, int raw_data) {
x = sanitizeHorizontalCoordinate(x);
y = sanitizeVerticalCoordinate(y);
z = sanitizeHorizontalCoordinate(z);
Chunk chunk = this.getChunkWorldCoordinates(x, y, z);
if (chunk != null)
chunk.pokeRawSilently(x, y, z, raw_data);
}
use of io.xol.chunkstories.api.world.chunk.Chunk in project chunkstories by Hugobros3.
the class ChunkLightBaker method pokeRawFast.
private void pokeRawFast(int x, int y, int z, int data) {
// Still within bounds !
CubicChunk relevantChunk = findRelevantChunk(x, y, z);
if (relevantChunk != null) {
chunk.pokeRawSilently(x, y, z, data);
return;
}
int oldData = world.peekRaw(x + chunkX * 32, y + chunkY * 32, z + chunkZ * 32);
world.pokeRawSilently(x + chunkX * 32, y + chunkY * 32, z + chunkZ * 32, data);
Chunk updateme = world.getChunkWorldCoordinates(x + chunkX * 32, y + chunkY * 32, z + chunkZ * 32);
if (updateme != null && oldData != data)
updateme.lightBaker().requestLightningUpdate();
}
Aggregations