Commit graph

48 commits

Author SHA1 Message Date
fb712cd2f5
Store per-region biome list in IndexSet
Index into the biome list instead of duplicating the biome data for each
coordinate. This reduces the size of the processed data and speeds up
encoding/decoding.
2023-08-03 23:07:16 +02:00
429b7888f6
world/de: add level.dat data structures
We only need the spawn point from level.dat.
2023-07-02 23:08:43 +02:00
42cb342749
world/layer: avoid iproduct-based iterator in inner loop
iproduct iterators are fairly slow. As the iterator implementation is
now unused, it is removed as well.
2023-05-10 00:48:53 +02:00
31eb92864c
Split up BlockInfo type
By storing block types and depth values separately, the processed world
data can be compressed better, decreasing data size by ~10%.
2023-05-06 00:52:40 +02:00
0b392d7a3a
world/layer: move more top_layer() logic into LayerEntry::fill() 2023-05-06 00:33:34 +02:00
0437ec70b6
world/layer: introduce LayerEntry struct 2023-05-06 00:33:13 +02:00
2d5eec13c2
world/layer: move Option into BlockInfo struct
Preparation for top_layer() cleanup.
2023-05-05 23:29:57 +02:00
263fc6d6ce
world/layer: remove unused y coordinate from BlockInfo 2023-05-05 23:15:34 +02:00
924ee01f91
world/layer: introduce LayerData struct to fix clippy type complexity warning 2023-05-05 23:08:39 +02:00
e912f60ba3
world/layer: add biome data to returned layer 2023-04-09 22:56:02 +02:00
0d2c99dacf
world/chunk: include biomes in section iterator item 2023-04-08 21:20:00 +02:00
ddc515a9d7
world/section: implement biome_at() 2023-04-08 21:20:00 +02:00
aa2edc3d13
world/section: move biome_types field out of BiomesV0 enum 2023-04-08 21:20:00 +02:00
c6843cfb9c
world: resolve biome palette entries for v1.18 biome data 2023-04-07 09:38:31 +02:00
b8b0e0627f
world: correctly name BiomesV1_18 2023-04-07 09:37:02 +02:00
e117c76937 world: pass biome data into chunk/section structures 2023-04-07 09:34:56 +02:00
f2b7808e84
world: distinguish pre-v1.18 biome data structures 2023-04-02 18:17:13 +02:00
bcec704d27
main: add height-based color modification
Modify terrain color depending on the height to give a sense of
elevation.
2023-03-04 21:45:59 +01:00
116e7e5fb6
world/layer: collect block light data with top layer 2023-03-04 20:36:05 +01:00
4fd316f3fc
world/layer: return None from top_layer() for empty chunks
Allow ignoring these chunks for the light map as well.
2023-03-04 20:33:10 +01:00
51602d5fc1 world/chunk: add block light to section iterator items 2023-03-04 17:38:56 +01:00
482471492c world/chunk: store BlockLight data in section map 2023-03-04 17:38:56 +01:00
b4eb0d39f9 world/section: add BlockLight type 2023-03-04 17:38:56 +01:00
66f8d155f5
world/section: reorder type definitions 2023-03-04 16:58:52 +01:00
47dc3795a3
world: introduce SectionIterItem struct 2023-03-04 16:57:59 +01:00
56573640fd
world/section: prefer slice references to Vec and fastnbt types
Makes the code a bit nicer and saves repeated deref calls into fastnbt.
2023-03-04 00:36:58 +01:00
26555f1745
src/world/layer: make BlockInfo fields public
There were left private by accident.
2023-03-03 20:36:09 +01:00
1d4c7a86ff
world/layer: replace iproduct!() with nested loops
iproduct!() is slow for more than 2 parameters.
2023-03-02 01:00:55 +01:00
04bc3e5d53
world/section: perform palette lookups early
Look up block types for all palette entries once during section
construction, rather than on block_at(), reducing the number of HashMap
lookups by ~1000.
2023-03-02 00:37:25 +01:00
5c82b80924
world/section: replace block_id_at() method with block_at()
Directly return a BlockType, preparing for early lookup of palettes.
2023-03-02 00:31:34 +01:00
f2ab424590
world: store BlockTypes in section types
Prepare for sections returning BlockType data directly instead of block IDs.
2023-03-02 00:24:59 +01:00
4c2fd6c1a9
resource: rename BlockTypeMap to BlockTypes
The block_types() function it turned into a Default implementation.
2023-03-01 23:59:27 +01:00
cbbc6d8f35
resource: make BlockTypeMap return BlockType without reference 2023-03-01 21:58:29 +01:00
f47b38b2ca
world/layer: return boxed BlockInfoArray from top_layer()
Avoid copying around large structures, and allow creating
arrays of BlockInfoArrays without overflowing the stack.
2023-02-27 19:17:17 +01:00
551056803d
Add Serialize/Deserialize impls to various types
We want to be able to store this data to disk temporarily.
2023-02-26 00:46:50 +01:00
f48aa877d2
world: implement top_layer function
Implement one of the core functions of MinedMap: finding the topmost
visible block at each coordinate.
2023-02-18 11:51:24 +01:00
decb5c67a6
world/section: to not use u128 type
Getting the block index for unaligned blocks can be done just fine with
only u64.
2023-02-18 10:57:11 +01:00
921a218d56
types: split BlockCoords into SectionBlockCoords and LayerBlockCoords 2023-02-15 00:35:18 +01:00
9f8446885e
treewide: remove get_ prefix from function names
Follow the conventions of the std library.
2023-02-12 23:36:58 +01:00
96736bd7ed
Replace DivRem trait with num-integer crate 2023-02-12 23:08:53 +01:00
9146c06bec
treewide: rename "old" data structures to "v0"
"v0" doesn't refer to a specific version of Minecraft; it is just the
oldest data format supported by MinedMap.
2023-02-12 23:03:58 +01:00
493608ebc8
treewide: add more documentation 2023-02-12 23:03:58 +01:00
c34f531546
world/section: temporarily rename PaletteSectionBiomes fields
These fields are unused for now. Add an underscore to supress linter
warnings.
2023-02-12 23:03:58 +01:00
65c39ea153
types: make CHUNKS_PER_REGION and BLOCKS_PER_CHUNK usize
Having these as usize is more convenient.
2023-02-12 23:03:58 +01:00
b918ff6106
world/section: add method to get block ID at coordinate 2023-02-12 23:03:58 +01:00
c130f3cdae
world: add section iterator
An (empty for now) trait is introduced to abstract over the two section
types.
2023-02-12 23:03:57 +01:00
2d782f25b1
world: add types to wrap common parts of section data 2023-02-12 23:03:57 +01:00
6379472282
world/de: new module for deserialization data structures
The new structures contain only the fields that MinedMap needs.
2023-02-07 18:32:01 +01:00