Skip to content

Commit

Permalink
fix: structure files don't need DataVersion to match
Browse files Browse the repository at this point in the history
  • Loading branch information
BPR02 committed Dec 13, 2024
1 parent 2a59fc0 commit cb19247
Show file tree
Hide file tree
Showing 20 changed files with 181 additions and 1 deletion.
4 changes: 3 additions & 1 deletion beet_observer/data_pack.py
Original file line number Diff line number Diff line change
@@ -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(
Expand Down Expand Up @@ -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]
Expand Down
13 changes: 13 additions & 0 deletions examples/overlay_adds_structure/beet.yaml
Original file line number Diff line number Diff line change
@@ -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
Binary file not shown.
Binary file not shown.
6 changes: 6 additions & 0 deletions examples/overlay_adds_structure/proc/pack.mcmeta
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"pack": {
"pack_format": 48,
"description": ""
}
}
Binary file not shown.
13 changes: 13 additions & 0 deletions examples/overlay_deletes_structure/beet.yaml
Original file line number Diff line number Diff line change
@@ -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
Binary file not shown.
6 changes: 6 additions & 0 deletions examples/overlay_deletes_structure/proc/pack.mcmeta
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"pack": {
"pack_format": 48,
"description": ""
}
}
Binary file not shown.
Binary file not shown.
12 changes: 12 additions & 0 deletions examples/overlay_replaces_structure/beet.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
data_pack:
load: src
pack_format: 57
supported_formats: [48,57]

pipeline:
- beet_observer

meta:
observer:
overlays:
- process: proc
Binary file not shown.
Binary file not shown.
6 changes: 6 additions & 0 deletions examples/overlay_replaces_structure/proc/pack.mcmeta
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"pack": {
"pack_format": 48,
"description": ""
}
}
Binary file not shown.
Binary file not shown.
40 changes: 40 additions & 0 deletions tests/snapshots/examples__build_overlay_adds_structure__0.pack.md
Original file line number Diff line number Diff line change
@@ -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`
Original file line number Diff line number Diff line change
@@ -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`
Original file line number Diff line number Diff line change
@@ -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`

0 comments on commit cb19247

Please sign in to comment.