Commit graph

186 commits

Author SHA1 Message Date
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
5ee114ed0a
types: slightly simplify DivRev trait 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
3cee4a4247
resource: port legacy block type mapping from old implementation 2023-02-12 23:03:57 +01:00
8add7679a3
types: add Eq to coordinate types 2023-02-12 23:03:57 +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
b040a635ed
types: add types for block and section coordinates 2023-02-12 23:03:57 +01:00
357ef46731
types: add helper for division + remainder
We frequently require these operations together when converting between
bit and byte offsets, or similar purposes.
2023-02-12 23:03:57 +01:00
718ecf5909
resource: update block type code generator for Rust 2023-02-07 22:18:44 +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
8c34f74952
io/region: return sorted Vec instead of HashMap from parse_header()
Instead of counting and looking up indices in the HashMap, we can just
iterate over all offsets in the returned Vec.
2023-01-30 19:08:51 +01:00
6186a0d916
io/region: accept incomplete block for final chunk 2023-01-30 00:45:05 +01:00
92a9bb3bb3
io/region: add chunk coords to error descriptions 2023-01-29 17:08:39 +01:00
1d126ba771
io/region: remove error handling for impossible cases from decode_chunk() 2023-01-29 17:04:28 +01:00
7c7e36f6be
io/region: avoid panic for invalid chunk lengths 2023-01-29 00:54:18 +01:00
da8ac506d9
io: remove a few unnecessary [..] for Vec -> slice deref 2023-01-28 01:15:00 +01:00
3cdafa7be9
Fix clippy warnings 2023-01-27 23:01:01 +01:00
daa188eb1d
io/region: use ChunkArray to parse region header
A layout of a ChunkArray::<u32> matches the binary format of the region
header.
2023-01-27 22:54:08 +01:00
28b22ce423
Introduce ChunkArray type
A generic array for per-chunk data, indexed by ChunkCoords.
2023-01-27 22:05:49 +01:00
48e03aa266
Introduce ChunkCoords type 2023-01-27 22:01:41 +01:00
0d8b989c10
io/region: remove count variable from Region::foreach_chunk() 2023-01-25 21:47:17 +01:00
5e96be3fda
Refactor logic from new dump tools into library crate 2023-01-25 21:42:16 +01:00
5a364e2434 Add new regiondump implemention 2023-01-25 21:41:34 +01:00
ddd78079dc Add new nbtdump util 2023-01-25 03:00:07 +01:00
40105aaccd Initial Rust setup 2023-01-25 00:06:27 +01:00
4b83f6376f Remove C++ implementation 2023-01-25 00:06:27 +01:00
c7e04649ff
Resource: Biome: add 1.19 biomes
Add the new biome temperature and rainfall values, as found in
decompiled Minecraft code:

- Deep Dark uses the same the values as plains
- Mangrove Swamp has the same temperature/rainfall as regular Swamp, but a
  different water color
2022-10-16 13:14:31 +02:00
Andrew Cox
600a20cde6
Update to compile on Mac OS (#26) 2022-07-01 23:27:58 +02:00
Bruno Saad
7bba6d0863 Adding new blocks for 1.19 2022-06-07 16:48:43 +00:00
fbef307c90
UniqueCPtr: add doc comment
Explain what a UniqueCPtr is.
2022-02-09 21:26:12 +01:00
37340926f4
MinedMap: fix warning for unused fscanf result 2021-12-19 23:11:21 +01:00
fac2e4c8da
World: Chunk: add support for unordered sections
MC1.18 doesn't always store sections sorted by their Y value, possibly
related to "optimize world".
2021-12-12 12:18:18 +01:00
a2fe33ef1f
World: Section: add support for Int tag section Y values
For some reason, MC1.18 sometimes uses Int instead of Byte tags for
section Y values after "optimize world". Add support for this (but still
only accept values that fit in a int8_t).
2021-12-12 12:15:31 +01:00
d18e004743
World: Section: fix biome palette size check
We were accidentally checking the block type palette size.
2021-12-12 10:28:17 +01:00
73dfecf379
Resource: BlockType: update colors with MC1.18 texture data 2021-12-11 22:50:24 +01:00
baa20494bf
World: Section: implement new section-based biome data format 2021-12-11 22:50:24 +01:00
76e5d322b1
Resource: Biome: add biome palette name mapping
For now we will continue to use the numerical biome IDs internally, as
our biome storage format is based on these IDs.
2021-12-11 22:50:23 +01:00
aacea26716
World: add support for negative Y coordinates and MC 1.18 chunks
MC 1.18 biomes are not handled yet.
2021-12-11 22:50:23 +01:00
9ee1007ade
World: Chunk: use enum to store biome data format 2021-12-11 22:50:23 +01:00
21966252ea
World: ChunkData: make getRoot() return shared pointer reference 2021-12-11 22:50:23 +01:00
16a1258f08
World: Chunk: remove unnecessary level class member 2021-12-11 22:50:23 +01:00
0f6c467566
World: Chunk: replace division/modulo with shift/mask for height values
Preparation for negative y coordinates.
2021-12-11 22:50:23 +01:00
457e993c92
Introduce separate types for block/section/chunk indices
Newtypes are cumbersome in C++, so this is mostly documentation for now.

Also replace lots of questionable uses of size_t with int or types with
explicit width and add a few comments for constants.
2021-12-11 22:50:23 +01:00
d4be401bcd
Resource: Biome: fix integer underflow
Explicitly cast height value to signed integer to fix incorrect biome color
values below a height of 64.
2021-12-11 22:28:22 +01:00
fd4773c8ca
treewide: replace license headers with SPDX-License-Identifier 2021-11-17 12:07:56 +01:00