diff --git a/beet_observer/data_pack.py b/beet_observer/data_pack.py index e95ca88..9c15d81 100644 --- a/beet_observer/data_pack.py +++ b/beet_observer/data_pack.py @@ -1,7 +1,7 @@ from typing import Any import beet.contrib.worldgen as wg -from beet import Context, NamespaceProxy +from beet import Context, NamespaceProxy, Structure def gen_dp_overlays( @@ -214,6 +214,8 @@ def gen_registry_overlay( else: # check if files are exactly the same try: + if isinstance(registry[name],Structure): + registry_overlay[name].data['DataVersion'] = registry[name].data['DataVersion'] if registry[name].data != registry_overlay[name].data: # move file from overlay pack to overlay in build pack ctx.data.overlays[overlay_dir][name] = registry_overlay[name] diff --git a/examples/overlay_adds_structure/beet.yaml b/examples/overlay_adds_structure/beet.yaml new file mode 100644 index 0000000..dbd4727 --- /dev/null +++ b/examples/overlay_adds_structure/beet.yaml @@ -0,0 +1,13 @@ +data_pack: + load: src + pack_format: 57 + supported_formats: [48,57] + +pipeline: + - beet_observer + +meta: + observer: + default_format: 57 + overlays: + - process: proc diff --git a/examples/overlay_adds_structure/proc/data/demo/structure/demo.nbt b/examples/overlay_adds_structure/proc/data/demo/structure/demo.nbt new file mode 100644 index 0000000..0a1166b Binary files /dev/null and b/examples/overlay_adds_structure/proc/data/demo/structure/demo.nbt differ diff --git a/examples/overlay_adds_structure/proc/data/demo/structure/foo.nbt b/examples/overlay_adds_structure/proc/data/demo/structure/foo.nbt new file mode 100644 index 0000000..ed304e0 Binary files /dev/null and b/examples/overlay_adds_structure/proc/data/demo/structure/foo.nbt differ diff --git a/examples/overlay_adds_structure/proc/pack.mcmeta b/examples/overlay_adds_structure/proc/pack.mcmeta new file mode 100644 index 0000000..8b4f4d2 --- /dev/null +++ b/examples/overlay_adds_structure/proc/pack.mcmeta @@ -0,0 +1,6 @@ +{ + "pack": { + "pack_format": 48, + "description": "" + } +} diff --git a/examples/overlay_adds_structure/src/data/demo/structure/foo.nbt b/examples/overlay_adds_structure/src/data/demo/structure/foo.nbt new file mode 100644 index 0000000..896fa35 Binary files /dev/null and b/examples/overlay_adds_structure/src/data/demo/structure/foo.nbt differ diff --git a/examples/overlay_deletes_structure/beet.yaml b/examples/overlay_deletes_structure/beet.yaml new file mode 100644 index 0000000..dbd4727 --- /dev/null +++ b/examples/overlay_deletes_structure/beet.yaml @@ -0,0 +1,13 @@ +data_pack: + load: src + pack_format: 57 + supported_formats: [48,57] + +pipeline: + - beet_observer + +meta: + observer: + default_format: 57 + overlays: + - process: proc diff --git a/examples/overlay_deletes_structure/proc/data/demo/structure/foo.nbt b/examples/overlay_deletes_structure/proc/data/demo/structure/foo.nbt new file mode 100644 index 0000000..ed304e0 Binary files /dev/null and b/examples/overlay_deletes_structure/proc/data/demo/structure/foo.nbt differ diff --git a/examples/overlay_deletes_structure/proc/pack.mcmeta b/examples/overlay_deletes_structure/proc/pack.mcmeta new file mode 100644 index 0000000..8b4f4d2 --- /dev/null +++ b/examples/overlay_deletes_structure/proc/pack.mcmeta @@ -0,0 +1,6 @@ +{ + "pack": { + "pack_format": 48, + "description": "" + } +} diff --git a/examples/overlay_deletes_structure/src/data/demo/structure/demo.nbt b/examples/overlay_deletes_structure/src/data/demo/structure/demo.nbt new file mode 100644 index 0000000..0f64ed6 Binary files /dev/null and b/examples/overlay_deletes_structure/src/data/demo/structure/demo.nbt differ diff --git a/examples/overlay_deletes_structure/src/data/demo/structure/foo.nbt b/examples/overlay_deletes_structure/src/data/demo/structure/foo.nbt new file mode 100644 index 0000000..896fa35 Binary files /dev/null and b/examples/overlay_deletes_structure/src/data/demo/structure/foo.nbt differ diff --git a/examples/overlay_replaces_structure/beet.yaml b/examples/overlay_replaces_structure/beet.yaml new file mode 100644 index 0000000..41b69cb --- /dev/null +++ b/examples/overlay_replaces_structure/beet.yaml @@ -0,0 +1,12 @@ +data_pack: + load: src + pack_format: 57 + supported_formats: [48,57] + +pipeline: + - beet_observer + +meta: + observer: + overlays: + - process: proc diff --git a/examples/overlay_replaces_structure/proc/data/demo/structure/demo.nbt b/examples/overlay_replaces_structure/proc/data/demo/structure/demo.nbt new file mode 100644 index 0000000..ac64a24 Binary files /dev/null and b/examples/overlay_replaces_structure/proc/data/demo/structure/demo.nbt differ diff --git a/examples/overlay_replaces_structure/proc/data/demo/structure/foo.nbt b/examples/overlay_replaces_structure/proc/data/demo/structure/foo.nbt new file mode 100644 index 0000000..ed304e0 Binary files /dev/null and b/examples/overlay_replaces_structure/proc/data/demo/structure/foo.nbt differ diff --git a/examples/overlay_replaces_structure/proc/pack.mcmeta b/examples/overlay_replaces_structure/proc/pack.mcmeta new file mode 100644 index 0000000..8b4f4d2 --- /dev/null +++ b/examples/overlay_replaces_structure/proc/pack.mcmeta @@ -0,0 +1,6 @@ +{ + "pack": { + "pack_format": 48, + "description": "" + } +} diff --git a/examples/overlay_replaces_structure/src/data/demo/structure/demo.nbt b/examples/overlay_replaces_structure/src/data/demo/structure/demo.nbt new file mode 100644 index 0000000..91f3369 Binary files /dev/null and b/examples/overlay_replaces_structure/src/data/demo/structure/demo.nbt differ diff --git a/examples/overlay_replaces_structure/src/data/demo/structure/foo.nbt b/examples/overlay_replaces_structure/src/data/demo/structure/foo.nbt new file mode 100644 index 0000000..896fa35 Binary files /dev/null and b/examples/overlay_replaces_structure/src/data/demo/structure/foo.nbt differ diff --git a/tests/snapshots/examples__build_overlay_adds_structure__0.pack.md b/tests/snapshots/examples__build_overlay_adds_structure__0.pack.md new file mode 100644 index 0000000..066bc93 --- /dev/null +++ b/tests/snapshots/examples__build_overlay_adds_structure__0.pack.md @@ -0,0 +1,40 @@ +# Lectern snapshot + +## Data pack + +`@data_pack pack.mcmeta` + +```json +{ + "pack": { + "pack_format": 57, + "description": "", + "supported_formats": [ + 48, + 57 + ] + }, + "overlays": { + "entries": [ + { + "formats": 48, + "directory": "overlay_48" + } + ] + } +} +``` + +### demo + +[`@structure demo:foo`](data:application/octet-stream;base64,H4sIAKO0W2cC/0WMwQqDQAxER1Zb19If6rnnHr2nEiFUd2WTk/58oyAGBjLDvOmAiFpl5QBgV3Uq4vad8vDTbncBjRoZ++9EWLKewHUR94UmNuMDaVF/aGY8Z0k8FBrtRVK81XIyMeFj2TcebzLquajk5MGGP9V3+RCWAAAA) + +## Overlay `overlay_48` + +`@overlay overlay_48` + +### demo + +[`@structure demo:demo`](data:application/octet-stream;base64,H4sIAAAAAAAAA0WMsQqDQBBER04Tz6TPb6RObZ0yrWx0A0u8O3G3ytfnPBAHBmZg3nSAR63yYwdgc7Xb4/Se0/jVbmsOjRoZ55wJtyTdgUMe54VmNuOCtKifFBi3IJHHlT72mIRCitNQjvO+5Whiwlp4h0tPRi9eVVIErnf8AexFbD2gAAAA) + +`@endoverlay` diff --git a/tests/snapshots/examples__build_overlay_deletes_structure__0.pack.md b/tests/snapshots/examples__build_overlay_deletes_structure__0.pack.md new file mode 100644 index 0000000..e9d0bf1 --- /dev/null +++ b/tests/snapshots/examples__build_overlay_deletes_structure__0.pack.md @@ -0,0 +1,40 @@ +# Lectern snapshot + +## Data pack + +`@data_pack pack.mcmeta` + +```json +{ + "pack": { + "pack_format": 57, + "description": "", + "supported_formats": [ + 48, + 57 + ] + }, + "overlays": { + "entries": [ + { + "formats": 57, + "directory": "default_overlay" + } + ] + } +} +``` + +### demo + +[`@structure demo:foo`](data:application/octet-stream;base64,H4sIAKO0W2cC/0WMwQqDQAxER1Zb19If6rnnHr2nEiFUd2WTk/58oyAGBjLDvOmAiFpl5QBgV3Uq4vad8vDTbncBjRoZ++9EWLKewHUR94UmNuMDaVF/aGY8Z0k8FBrtRVK81XIyMeFj2TcebzLquajk5MGGP9V3+RCWAAAA) + +## Overlay `default_overlay` + +`@overlay default_overlay` + +### demo + +[`@structure demo:demo`](data:application/octet-stream;base64,H4sIAAAAAAAAA0WLsQqDQBBER84YzwTyK9apU6dMv5EJLOqduFvl63MKkoEHMzCvAyJq0y8DgI3qIKJ5T3kYrdtWwMlcnKUXIyzZDuGfiPMiE925Ky3qp8zEbdbEYZWP381zYvm1TK6utN0LuDzE5cXVNCfg2uMHeoPLa5gAAAA=) + +`@endoverlay` diff --git a/tests/snapshots/examples__build_overlay_replaces_structure__0.pack.md b/tests/snapshots/examples__build_overlay_replaces_structure__0.pack.md new file mode 100644 index 0000000..9884239 --- /dev/null +++ b/tests/snapshots/examples__build_overlay_replaces_structure__0.pack.md @@ -0,0 +1,42 @@ +# Lectern snapshot + +## Data pack + +`@data_pack pack.mcmeta` + +```json +{ + "pack": { + "pack_format": 57, + "description": "", + "supported_formats": [ + 48, + 57 + ] + }, + "overlays": { + "entries": [ + { + "formats": 48, + "directory": "overlay_48" + } + ] + } +} +``` + +### demo + +[`@structure demo:demo`](data:application/octet-stream;base64,H4sIAKO0W2cC/0WMwQrCQBBDI1t1tx78H8+ePXofSwqD7W7pzKkf5Te6LZQGAgnkpQUSGtOFAcDq0+6Ey2co3dfatQWczcVZcyXCVGwHDiVcJxnozg2JaF4yEvdRM7tZen+Yl8y6i8yurty+68vtKS5vzqYlA/GHP4N8NoiYAAAA) + +[`@structure demo:foo`](data:application/octet-stream;base64,H4sIAKO0W2cC/0WMwQqDQAxER1Zb19If6rnnHr2nEiFUd2WTk/58oyAGBjLDvOmAiFpl5QBgV3Uq4vad8vDTbncBjRoZ++9EWLKewHUR94UmNuMDaVF/aGY8Z0k8FBrtRVK81XIyMeFj2TcebzLquajk5MGGP9V3+RCWAAAA) + +## Overlay `overlay_48` + +`@overlay overlay_48` + +### demo + +[`@structure demo:demo`](data:application/octet-stream;base64,H4sIAKO0W2cC/0WNwQrCMBBEp6TWpH6A/+K5Z49eZW1XWNokpbsnP8pvNA0UBwZ2YN9MDwS0Kh92AHY3hwO615LHWfs9OZzUyLjchXBr1gP4K+C80sJmXBGP9k6RcY2SeNzobbdJKOY0PWtx+fecTEy4bpS2y0BGD95UcgL8Fz8VupHeoAAAAA==) + +`@endoverlay`