-
Notifications
You must be signed in to change notification settings - Fork 4
/
TODO.txt
52 lines (50 loc) · 2.8 KB
/
TODO.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
- Other NBT .dat files: World.data, for the "data/" dir, playerdata
- World JSON data: stats, advancements
- Easy, path-like way to locate and print an NBT data in World
- see walk_nbt() and extend it to all World filesystem
- @property subpath, relative to parent, for all classes:
- Level: path.stem() [always "level.dat"]
- Dimension: path.relative_to(world.path)
- Regions: category
- Region: path.stem()
- Chunk: "chunk.{cx}.{cz}"
- Custom Dimensions
- Convert Dimension to a full-fledged class
- Overworld, Nether and The End are singleton instances
- Deal directly with Chunks in World, making Regions an implementation detail of Chunk
- World should care only about (cx, cz) chunks in a category/dimension
- Chunk.{save,load}(), internally invoking its region
- Decouple Anvil/Regions and NBT parsing Library
- AnvilRegion.load() store compressed NBT and return NBT decompressing on-the-fly,
fully agnostic about NBT content
- Dirty control. Possible strategies:
- Manual control, user sets chunk.changed = True (Amulet approach)
- Custom __setitem__/__delitem__ on Compound and List to auto-set dirty
- Serializing+Hashing content to detect changes:
- serialize and hash Root on parse(), keep result, do it again on write() and compare
- serializing must be *MUCH* faster than write(), otherwise just compare binary NBT
- hashes: md5, python's hash()
- serializations: JSON, Pickle, walk, str/repr(sorted(dict.items())), msgpack
- Fully support MCC files
- *Pos*() constructor should accept a single iterable in constructor, like tuple()
- Currently Pos(1, 2) is OK, Pos(pos) is not, and vice-versa for tuple()
- Method signatures that take a Pos must either be:
- Pos.method(otherpos), inconsistent with constructor, or
- Pos.method(*otherpos), forcing an un-natural unpacking
- Can't (trivially) override typing.NamedTuple.__new__, or subclass it
- dataclasses also do not accept single iterable in constructor, and are not isinstance(tuple)
- No other is as fast as NamedTuple: https://death.andgravity.com/namedtuples
- Minecraft Data Model:
- Classes are not tied to NBT, only on save()/load()
- Constructor gets references to parent and globals, assign empty instances to attributes
- def __init__(parent, ...): self.parent=parent; self.x = 0; self.y = Y(self)
- save() gets an NBT container to save at, created by caller, usually empty, and fill with data
- def save(tag): tag['x'] = Tag(self.x); tag['y'] = self.y.save(Tag())
- load() gets an NBT container with data and assign self attributes
- def load(tag): self.x = tag['x'].unpack(); self.y.load(tag['y'])
Similar tools:
https://github.com/TkTech/PyNBT
https://github.com/Amulet-Team/Amulet-NBT
https://github.com/twoolie/NBT
https://github.com/nwesterhausen/py-mcdata-to-json
https://gist.github.com/nwesterhausen/527fb947d4432c1f40c06dca07cb9253