Moved warning about ./world folder to only appear when necessary +
Updated warning contents to reflect changes
Made the save_file in the `Level` struct optional
in case someone wants an entirely generated World.
Removed now redundant asserts.
When loading a partially generated world there's some
incomplete chunks that might not have a heightmap yet.
If that is the case we return a ChunkNotGeneratedError
to indicate that it's ok to (re-)generate it.
Added new error types to indicate a chunk should be generated.
Renamed to `fetch_chunks` to indicate that it no longer just reads chunks (might write to the worldfile in the future)
Take a reference to a slice instead of an owned vector because the data is Copy anyways.
Remove the ChunkCoordinates that are sent over the mpsc Sender.
- The coordinates are stored in ChunkData anyways.
- If there is an Error the coordinates should not matter because the error can't be recovered from.
Moved the reading from file logic to `read_chunk`.
- So that we don't always have to repeat `channel.blocking_send(...); return;`
- To make it clearly distinct from the main program logic.
Replaced some verbose match statements with `Result.map_err()`.
Moved `BlockId` to it's own file.
Prefixed all of the `block_registry` types with Registry to avoid confusion.
Made stuff that should not be public private.
Simply count blocks instead of doing some complex operation with k/j/i
Marked comment with TODO
Replaced if/else condition with std::cmp::max
Removed some redundant `.enumerate()`s
`i32` is really ambiguous and it is not immediately obvious what it is supposed to represent.
`BlockId` is much more readable.
Changed internal type to u16 because we currently have ~30k/64k block states.
(and i32 doesn't make a lot of sense for an Id, except when replicating mojang behavior)
renamed a few fields for clarity.
added examples for fields that might not immediately be obvious.
removed some `Option`s that are not necessary.
renamed `BlockElement` to `BlockType` because you could mistake
`BlockElement` for the main way to represent a Block (e.g. in Chunks).
Renamed `WORLD_Y_START_AT` to `WORLD_LOWEST_Y`.
Added `WORLD_Y_END_AT`.
Changed the type to i16 for ergonomics.
Moved the constants under the use statements for readability.