Looking for comments on this before I start implementing it.
public interface Chunk {
ChunkPosition getPosition();
void getChunkData(Mutable<ChunkData> reusableChunkData, Set<String> request, BlockPalette blockPalette, BiomePalette biomePalette, int yMin, int yMax);
boolean chunkChangedSince(int timestamp, int yMin, int yMax);
void getHeightmap(int[] chunkHeightmap, int yMin, int yMax);
//map view specific to be removed on map view rewrite
void renderSurface(MapTile tile);
void renderBiomes(MapTile tile);
int biomeColor();
void reset();
void queueTopography();
}
This is a step towards the world format api (#1038), making it much easier to add new chunk implementations. I'm thinking of keeping some of the map-view specific calls to avoid messing with it at all, but those can be removed with the map view rewrite in the future. (properly tracking the lifetime of chunks on the map view side is not something I want to look at)
The largest change here is that there is now only a single implementation of loading chunks (replacing the old loadChunk, loadSurface and getChunkData methods). It would then be up to the caller to implement the behaviour in terms of the ChunkData interface.
Another issue is that the Set<String> request passed to getChunkData is only compatible with worlds that stick very closely to the vanilla java nbt format (basically only vanilla and cubicchunks).
One idea I had is to pass a Request type that specifies whether blocks, biomes, entities, etc. should be loaded. Though I'm not sure how nice that is either.
Looking for comments on this before I start implementing it.
This is a step towards the world format api (#1038), making it much easier to add new chunk implementations. I'm thinking of keeping some of the map-view specific calls to avoid messing with it at all, but those can be removed with the map view rewrite in the future. (properly tracking the lifetime of chunks on the map view side is not something I want to look at)
The largest change here is that there is now only a single implementation of loading chunks (replacing the old
loadChunk
,loadSurface
andgetChunkData
methods). It would then be up to the caller to implement the behaviour in terms of theChunkData
interface.Another issue is that the
Set<String> request
passed togetChunkData
is only compatible with worlds that stick very closely to the vanilla java nbt format (basically only vanilla and cubicchunks). One idea I had is to pass aRequest
type that specifies whether blocks, biomes, entities, etc. should be loaded. Though I'm not sure how nice that is either.