mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-04-08 16:56:07 +00:00
implement ChunkAccess
This commit is contained in:
@@ -1,6 +1,31 @@
|
||||
package com.dfsek.terra.api.platform.world;
|
||||
|
||||
import com.dfsek.terra.api.platform.Handle;
|
||||
import com.dfsek.terra.api.platform.block.BlockData;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public interface ChunkAccess extends Handle {
|
||||
/**
|
||||
* Set the block at x,y,z in the chunk data to material.
|
||||
* <p>
|
||||
* Setting blocks outside the chunk's bounds does nothing.
|
||||
*
|
||||
* @param x the x location in the chunk from 0-15 inclusive
|
||||
* @param y the y location in the chunk from 0 (inclusive) - maxHeight (exclusive)
|
||||
* @param z the z location in the chunk from 0-15 inclusive
|
||||
* @param blockData the type to set the block to
|
||||
*/
|
||||
void setBlock(int x, int y, int z, @NotNull BlockData blockData);
|
||||
|
||||
/**
|
||||
* Get the type and data of the block at x, y, z.
|
||||
* <p>
|
||||
* Getting blocks outside the chunk's bounds returns air.
|
||||
*
|
||||
* @param x the x location in the chunk from 0-15 inclusive
|
||||
* @param y the y location in the chunk from 0 (inclusive) - maxHeight (exclusive)
|
||||
* @param z the z location in the chunk from 0-15 inclusive
|
||||
* @return the data of the block or the BlockData for air if x, y or z are outside the chunk's bounds
|
||||
*/
|
||||
@NotNull BlockData getBlockData(int x, int y, int z);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.dfsek.terra.api.platform.world.generator;
|
||||
|
||||
import com.dfsek.terra.api.platform.Handle;
|
||||
import com.dfsek.terra.api.platform.block.BlockData;
|
||||
import com.dfsek.terra.api.platform.world.BiomeGrid;
|
||||
import com.dfsek.terra.api.platform.world.ChunkAccess;
|
||||
import com.dfsek.terra.api.platform.world.World;
|
||||
@@ -40,31 +39,5 @@ public interface ChunkGenerator extends Handle {
|
||||
* @return the maximum height
|
||||
*/
|
||||
int getMaxHeight();
|
||||
|
||||
|
||||
/**
|
||||
* Set the block at x,y,z in the chunk data to material.
|
||||
* <p>
|
||||
* Setting blocks outside the chunk's bounds does nothing.
|
||||
*
|
||||
* @param x the x location in the chunk from 0-15 inclusive
|
||||
* @param y the y location in the chunk from 0 (inclusive) - maxHeight (exclusive)
|
||||
* @param z the z location in the chunk from 0-15 inclusive
|
||||
* @param blockData the type to set the block to
|
||||
*/
|
||||
void setBlock(int x, int y, int z, @NotNull BlockData blockData);
|
||||
|
||||
|
||||
/**
|
||||
* Get the type and data of the block at x, y, z.
|
||||
* <p>
|
||||
* Getting blocks outside the chunk's bounds returns air.
|
||||
*
|
||||
* @param x the x location in the chunk from 0-15 inclusive
|
||||
* @param y the y location in the chunk from 0 (inclusive) - maxHeight (exclusive)
|
||||
* @param z the z location in the chunk from 0-15 inclusive
|
||||
* @return the data of the block or the BlockData for air if x, y or z are outside the chunk's bounds
|
||||
*/
|
||||
@NotNull BlockData getBlockData(int x, int y, int z);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
package com.dfsek.terra.carving;
|
||||
|
||||
import com.dfsek.terra.api.platform.world.ChunkAccess;
|
||||
|
||||
public interface Carver {
|
||||
void carve(int chunkX, int chunkZ, ChunkAccess chunk);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user