chunky-dev / chunky-dev/chunky
Chunk interface proposal
- Dominant language
- Java
- Stars
- 738
- Forks
- 78
- Avg merge
- 10h 5m
- Merged PRs (30d)
- 3
Description
Looking for comments on this before I start implementing it.
```
public interface Chunk {
ChunkPosition getPosition();
void getChunkData(Mutable reusableChunkData, Set 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 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.
Contributor guide
Research direction
Start by reviewing the proposed Chunk interface and the related world format API issue #1038; no files or tests are named. Compare the single chunk-loading path, ChunkData request handling, and map-view-specific methods, then seek agreement on the API direction and compatibility goals before implementation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend-api-design
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100