beet-observer 0.6.0__py3-none-any.whl → 0.6.2__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- beet_observer/__init__.py +1 -1
- beet_observer/data_pack.py +5 -6
- beet_observer/plugin.py +30 -2
- beet_observer/resource_pack.py +0 -5
- {beet_observer-0.6.0.dist-info → beet_observer-0.6.2.dist-info}/METADATA +1 -1
- beet_observer-0.6.2.dist-info/RECORD +8 -0
- beet_observer-0.6.0.dist-info/RECORD +0 -8
- {beet_observer-0.6.0.dist-info → beet_observer-0.6.2.dist-info}/LICENSE +0 -0
- {beet_observer-0.6.0.dist-info → beet_observer-0.6.2.dist-info}/WHEEL +0 -0
beet_observer/__init__.py
CHANGED
beet_observer/data_pack.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
from typing import Any
|
2
2
|
|
3
3
|
import beet.contrib.worldgen as wg
|
4
|
-
from beet import Context, NamespaceProxy
|
4
|
+
from beet import Context, NamespaceProxy, Structure
|
5
5
|
|
6
6
|
|
7
7
|
def gen_dp_overlays(
|
@@ -124,11 +124,6 @@ def gen_dp_overlays(
|
|
124
124
|
continue
|
125
125
|
# check if it's the top-level overlay
|
126
126
|
if overlay == ctx.meta["observer"]["default_dir_dp"]:
|
127
|
-
# delete pack.mcmeta from overlay (required for tests)
|
128
|
-
default_dir = ctx.meta["observer"]["default_dir_dp"]
|
129
|
-
if ctx.data.overlays[default_dir].mcmeta:
|
130
|
-
del ctx.data.overlays[default_dir].mcmeta
|
131
|
-
|
132
127
|
# get pack format from build context
|
133
128
|
if "default_format" in ctx.meta["observer"]:
|
134
129
|
formats = ctx.meta["observer"]["default_format"]
|
@@ -219,6 +214,10 @@ def gen_registry_overlay(
|
|
219
214
|
else:
|
220
215
|
# check if files are exactly the same
|
221
216
|
try:
|
217
|
+
if isinstance(registry[name], Structure):
|
218
|
+
registry_overlay[name].data["DataVersion"] = registry[name].data[
|
219
|
+
"DataVersion"
|
220
|
+
]
|
222
221
|
if registry[name].data != registry_overlay[name].data:
|
223
222
|
# move file from overlay pack to overlay in build pack
|
224
223
|
ctx.data.overlays[overlay_dir][name] = registry_overlay[name]
|
beet_observer/plugin.py
CHANGED
@@ -7,6 +7,26 @@ from .resource_pack import *
|
|
7
7
|
def beet_default(ctx: Context):
|
8
8
|
if "observer" not in ctx.meta:
|
9
9
|
return
|
10
|
+
|
11
|
+
# # check cache
|
12
|
+
cache = ctx.cache["observer"]
|
13
|
+
cached_dp = False
|
14
|
+
cached_rp = False
|
15
|
+
dp_path = None
|
16
|
+
rp_path = None
|
17
|
+
if ctx.data:
|
18
|
+
dp_path = cache.get_path(f"{ctx.directory} saved_data_pack")
|
19
|
+
if dp_path.is_dir():
|
20
|
+
ctx.data.load(f"{dp_path}")
|
21
|
+
cached_dp = True
|
22
|
+
if ctx.assets:
|
23
|
+
rp_path = cache.get_path(f"{ctx.directory} saved_resource_pack")
|
24
|
+
if rp_path.is_dir():
|
25
|
+
ctx.assets.load(f"{rp_path}")
|
26
|
+
cached_rp = True
|
27
|
+
if cached_dp and cached_rp:
|
28
|
+
return
|
29
|
+
|
10
30
|
# get default directories
|
11
31
|
if "default_dir" not in ctx.meta["observer"]:
|
12
32
|
# default dir not defined
|
@@ -46,5 +66,13 @@ def beet_default(ctx: Context):
|
|
46
66
|
dp_dir = overlay["directory"]
|
47
67
|
rp_dir = overlay["directory"]
|
48
68
|
# compare build pack and overlay pack
|
49
|
-
|
50
|
-
|
69
|
+
if not cached_dp and ctx.data:
|
70
|
+
gen_dp_overlays(ctx, ctx_overlay, dp_dir, save)
|
71
|
+
if not cached_rp and ctx.assets:
|
72
|
+
gen_rp_overlays(ctx, ctx_overlay, rp_dir, save)
|
73
|
+
|
74
|
+
# save to cache
|
75
|
+
if not cached_dp and ctx.data:
|
76
|
+
ctx.data.save(path=dp_path)
|
77
|
+
if not cached_rp and ctx.assets:
|
78
|
+
ctx.assets.save(path=rp_path)
|
beet_observer/resource_pack.py
CHANGED
@@ -52,11 +52,6 @@ def gen_rp_overlays(
|
|
52
52
|
continue
|
53
53
|
# check if it's the top-level overlay
|
54
54
|
if overlay == ctx.meta["observer"]["default_dir_rp"]:
|
55
|
-
# delete pack.mcmeta from overlay (required for tests)
|
56
|
-
default_dir = ctx.meta["observer"]["default_dir_rp"]
|
57
|
-
if ctx.assets.overlays[default_dir].mcmeta:
|
58
|
-
del ctx.assets.overlays[default_dir].mcmeta
|
59
|
-
|
60
55
|
# get pack format from build context
|
61
56
|
if "default_format" in ctx.meta["observer"]:
|
62
57
|
formats = ctx.meta["observer"]["default_format"]
|
@@ -0,0 +1,8 @@
|
|
1
|
+
beet_observer/__init__.py,sha256=1bdBi_zNLpip86iamyYYtbrA-WFsbBnrNhqbSx3DP5M,45
|
2
|
+
beet_observer/data_pack.py,sha256=eENwNdgtMfqOXrXCbejnpCPCHca0dJadGLOimalzylQ,9754
|
3
|
+
beet_observer/plugin.py,sha256=mtGBtJNCiUHkSGiAoRl7li0oIlZBQ-cuDS91bubDaPs,2835
|
4
|
+
beet_observer/resource_pack.py,sha256=ZO6Ye-_17IAx5rvsht6Gd3IY10ZtevoOX20mZwxzWnk,5984
|
5
|
+
beet_observer-0.6.2.dist-info/LICENSE,sha256=oBbP6j7sgG9darFSRZxV7iO8yPR1aZiDspSK3mcLpXI,1062
|
6
|
+
beet_observer-0.6.2.dist-info/METADATA,sha256=WMIP8MCT3gM03CSueffQgPcQmwS2eTiE_u4-LirnDN0,674
|
7
|
+
beet_observer-0.6.2.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
|
8
|
+
beet_observer-0.6.2.dist-info/RECORD,,
|
@@ -1,8 +0,0 @@
|
|
1
|
-
beet_observer/__init__.py,sha256=1Bu06DCGzyW6_EOuOSqpm31Fvkl_thjvyH54vN4XjZ4,45
|
2
|
-
beet_observer/data_pack.py,sha256=QqoyQYiCBpqioaKYSUKANgd3dxJJFLGka92G3Tyz_Js,9800
|
3
|
-
beet_observer/plugin.py,sha256=YBxXXzWGGVKqJHTuYi9a3KQO6-E841OS3iHcTnKXg_s,2011
|
4
|
-
beet_observer/resource_pack.py,sha256=_a4Ubx8fO7HMnIbfQlsnYEIM_Vjo3o_QjarirqbWdkc,6233
|
5
|
-
beet_observer-0.6.0.dist-info/LICENSE,sha256=oBbP6j7sgG9darFSRZxV7iO8yPR1aZiDspSK3mcLpXI,1062
|
6
|
-
beet_observer-0.6.0.dist-info/METADATA,sha256=kgd3ISGBKRueQuQvvapeouk5auWa2FB4oldNV4vKW3w,674
|
7
|
-
beet_observer-0.6.0.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
|
8
|
-
beet_observer-0.6.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|