Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions examples/nosnap_extend_namespace/beet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@


pipeline:
- main
17 changes: 17 additions & 0 deletions examples/nosnap_extend_namespace/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from beet import Context, BinaryFile, NamespaceFileScope
from beet.contrib.vanilla import Vanilla
from typing import ClassVar


class UnihexZip(BinaryFile):
scope: ClassVar[NamespaceFileScope] = ()
extension: ClassVar[str] = ".zip"


def beet_default(ctx: Context):
vanilla = ctx.inject(Vanilla)
vanilla.assets.extend_namespace.append(UnihexZip)
unihex = vanilla.mount("assets/minecraft/font", fetch_objects=True).assets[
UnihexZip
]
print(unihex)
2 changes: 2 additions & 0 deletions src/beet/contrib/vanilla.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ def mount(
# triggering merge policies that might try to deserialize
# files before they're fully retrieved.
temp = ResourcePack()
temp.extend_namespace.extend(pack.extend_namespace)
temp.extend_namespace_extra.update(pack.extend_namespace_extra)
with self.cache.parallel_downloads():
temp.mount(prefix, object_mapping.with_prefix(prefix))
pack.merge(temp)
Expand Down