beet-observer 0.4.0__tar.gz → 0.6.0__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: beet-observer
3
- Version: 0.4.0
3
+ Version: 0.6.0
4
4
  Summary: A beet plugin to automatically generate overlays from previous datapacks
5
5
  License: MIT
6
6
  Author: BPR02
@@ -1,3 +1,3 @@
1
- __version__ = "0.4.0"
1
+ __version__ = "0.6.0"
2
2
 
3
3
  from .plugin import *
@@ -4,7 +4,9 @@ import beet.contrib.worldgen as wg
4
4
  from beet import Context, NamespaceProxy
5
5
 
6
6
 
7
- def gen_dp_overlays(ctx: Context, ctx_overlay: Context, overlay_dir: str) -> None:
7
+ def gen_dp_overlays(
8
+ ctx: Context, ctx_overlay: Context, overlay_dir: str, ignore: list[str]
9
+ ) -> None:
8
10
  """
9
11
  Generates overlays between two datapacks.
10
12
 
@@ -118,6 +120,8 @@ def gen_dp_overlays(ctx: Context, ctx_overlay: Context, overlay_dir: str) -> Non
118
120
 
119
121
  # add overlays to pack.mcmeta
120
122
  for overlay in ctx.data.overlays:
123
+ if overlay in ignore:
124
+ continue
121
125
  # check if it's the top-level overlay
122
126
  if overlay == ctx.meta["observer"]["default_dir_dp"]:
123
127
  # delete pack.mcmeta from overlay (required for tests)
@@ -24,14 +24,20 @@ def beet_default(ctx: Context):
24
24
  ctx.meta["observer"]["default_dir_rp"] = ctx.meta["observer"]["default_dir"][
25
25
  "rp"
26
26
  ]
27
+ # save current overlays
28
+ save: list[str] = []
29
+ for overlay in ctx.data.overlays:
30
+ save.append(overlay)
27
31
  # loop through all overlays
28
32
  for overlay in ctx.meta["observer"]["overlays"]:
29
- # create relative path
30
- path = f"{ctx.directory}/{overlay['process']}"
33
+ # get pack
34
+ if overlay["process"].startswith("https://"):
35
+ load = overlay["process"]
36
+ else:
37
+ load = f"{ctx.directory}/{overlay['process']}"
31
38
  # generate context for overlay pack
32
39
  with run_beet(
33
- config={"data_pack": {"load": "."}, "resource_pack": {"load": "."}},
34
- directory=path,
40
+ config={"data_pack": {"load": load}, "resource_pack": {"load": load}}
35
41
  ) as ctx_overlay:
36
42
  if "directory" not in overlay:
37
43
  dp_dir = f"overlay_{ctx_overlay.data.pack_format}"
@@ -40,5 +46,5 @@ def beet_default(ctx: Context):
40
46
  dp_dir = overlay["directory"]
41
47
  rp_dir = overlay["directory"]
42
48
  # compare build pack and overlay pack
43
- gen_dp_overlays(ctx, ctx_overlay, dp_dir)
44
- gen_rp_overlays(ctx, ctx_overlay, rp_dir)
49
+ gen_dp_overlays(ctx, ctx_overlay, dp_dir, save)
50
+ gen_rp_overlays(ctx, ctx_overlay, rp_dir, save)
@@ -3,7 +3,9 @@ from typing import Any
3
3
  from beet import Context, NamespaceProxy
4
4
 
5
5
 
6
- def gen_rp_overlays(ctx: Context, ctx_overlay: Context, overlay_dir: str) -> None:
6
+ def gen_rp_overlays(
7
+ ctx: Context, ctx_overlay: Context, overlay_dir: str, ignore: list[str]
8
+ ) -> None:
7
9
  """
8
10
  Generates overlays between two resource packs.
9
11
 
@@ -46,6 +48,8 @@ def gen_rp_overlays(ctx: Context, ctx_overlay: Context, overlay_dir: str) -> Non
46
48
 
47
49
  # add overlays to pack.mcmeta
48
50
  for overlay in ctx.assets.overlays:
51
+ if overlay in ignore:
52
+ continue
49
53
  # check if it's the top-level overlay
50
54
  if overlay == ctx.meta["observer"]["default_dir_rp"]:
51
55
  # delete pack.mcmeta from overlay (required for tests)
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "beet-observer"
3
- version = "0.4.0"
3
+ version = "0.6.0"
4
4
  description = "A beet plugin to automatically generate overlays from previous datapacks"
5
5
  authors = ["BPR02 <dev@bpr02.com>"]
6
6
  license = "MIT"
@@ -38,6 +38,7 @@ typeCheckingMode = "strict"
38
38
  [tool.poe.tasks]
39
39
  format = {shell = "isort beet_observer & black beet_observer"}
40
40
  check = {shell = "isort --check-only beet_observer & black --check beet_observer"}
41
+ typing = {shell = "pyright"}
41
42
 
42
43
  [build-system]
43
44
  requires = ["poetry-core"]
File without changes
File without changes