Skip to content

Commit

Permalink
feat: add particles
Browse files Browse the repository at this point in the history
  • Loading branch information
vberlier committed Apr 27, 2021
1 parent 6d88263 commit adaaf0d
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 0 deletions.
10 changes: 10 additions & 0 deletions beet/library/resource_pack.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"Texture",
"Sound",
"SoundConfig",
"Particle",
]


Expand Down Expand Up @@ -227,6 +228,13 @@ def merge(self, other: "SoundConfig") -> bool: # type: ignore
return True


class Particle(JsonFile, NamespaceFile):
"""Class representing a particle configuration file."""

scope = ("particles",)
extension = ".json"


class ResourcePackNamespace(Namespace):
"""Class representing a resource pack namespace."""

Expand All @@ -252,6 +260,7 @@ class ResourcePackNamespace(Namespace):
textures_mcmeta: NamespacePin[TextureMcmeta] = NamespacePin(TextureMcmeta)
textures: NamespacePin[Texture] = NamespacePin(Texture)
sounds: NamespacePin[Sound] = NamespacePin(Sound)
particles: NamespacePin[Particle] = NamespacePin(Particle)
# fmt: on

@classmethod
Expand Down Expand Up @@ -285,4 +294,5 @@ class ResourcePack(Pack[ResourcePackNamespace]):
textures_mcmeta: NamespaceProxyDescriptor[TextureMcmeta] = NamespaceProxyDescriptor(TextureMcmeta)
textures: NamespaceProxyDescriptor[Texture] = NamespaceProxyDescriptor(Texture)
sounds: NamespaceProxyDescriptor[Sound] = NamespaceProxyDescriptor(Sound)
particles: NamespaceProxyDescriptor[Particle] = NamespaceProxyDescriptor(Particle)
# fmt: on
12 changes: 12 additions & 0 deletions tests/snapshots/resource_pack__vanilla_particles_release__0.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"textures": [
"minecraft:glitter_7",
"minecraft:glitter_6",
"minecraft:glitter_5",
"minecraft:glitter_4",
"minecraft:glitter_3",
"minecraft:glitter_2",
"minecraft:glitter_1",
"minecraft:glitter_0"
]
}
12 changes: 12 additions & 0 deletions tests/snapshots/resource_pack__vanilla_particles_snapshot__0.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"textures": [
"minecraft:glitter_7",
"minecraft:glitter_6",
"minecraft:glitter_5",
"minecraft:glitter_4",
"minecraft:glitter_3",
"minecraft:glitter_2",
"minecraft:glitter_1",
"minecraft:glitter_0"
]
}
5 changes: 5 additions & 0 deletions tests/test_resource_pack.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,8 @@ def test_vanilla_shaders(snapshot: SnapshotFixture, minecraft_resource_pack: Pat
assert snapshot("json") == pack.shaders["minecraft:program/entity_outline"].data
assert snapshot() == pack.fragment_shaders["minecraft:program/wobble"].text
assert snapshot() == pack.vertex_shaders["minecraft:program/sobel"].text


def test_vanilla_particles(snapshot: SnapshotFixture, minecraft_resource_pack: Path):
pack = ResourcePack(path=minecraft_resource_pack)
assert snapshot("json") == pack.particles["minecraft:end_rod"].data

0 comments on commit adaaf0d

Please sign in to comment.