stewbeet 2.0.15__tar.gz → 2.0.16__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of stewbeet might be problematic. Click here for more details.

Files changed (141) hide show
  1. {stewbeet-2.0.15 → stewbeet-2.0.16}/PKG-INFO +1 -1
  2. {stewbeet-2.0.15 → stewbeet-2.0.16}/pyproject.toml +1 -1
  3. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/core/constants.py +6 -6
  4. stewbeet-2.0.16/stewbeet/core/utils/io.py +161 -0
  5. stewbeet-2.0.16/stewbeet/dependencies/datapack/Common Signals.zip +0 -0
  6. stewbeet-2.0.16/stewbeet/dependencies/datapack/Furnace NBT Recipes.zip +0 -0
  7. stewbeet-2.0.16/stewbeet/dependencies/datapack/ItemIO.zip +0 -0
  8. stewbeet-2.0.16/stewbeet/dependencies/datapack/SmartOreGeneration.zip +0 -0
  9. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/dependencies/datapack/Smithed Crafter.zip +0 -0
  10. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/dependencies/datapack/Smithed Custom Block.zip +0 -0
  11. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/dependencies/resource_pack/Smithed Crafter.zip +0 -0
  12. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/plugins/archive/__init__.py +11 -0
  13. stewbeet-2.0.15/stewbeet/core/utils/io.py +0 -136
  14. stewbeet-2.0.15/stewbeet/dependencies/datapack/Common Signals.zip +0 -0
  15. stewbeet-2.0.15/stewbeet/dependencies/datapack/Furnace NBT Recipes.zip +0 -0
  16. stewbeet-2.0.15/stewbeet/dependencies/datapack/ItemIO.zip +0 -0
  17. stewbeet-2.0.15/stewbeet/dependencies/datapack/SmartOreGeneration.zip +0 -0
  18. {stewbeet-2.0.15 → stewbeet-2.0.16}/.gitignore +0 -0
  19. {stewbeet-2.0.15 → stewbeet-2.0.16}/LICENSE +0 -0
  20. {stewbeet-2.0.15 → stewbeet-2.0.16}/README.md +0 -0
  21. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/__init__.py +0 -0
  22. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/__main__.py +0 -0
  23. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/continuous_delivery/__init__.py +0 -0
  24. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/continuous_delivery/cd_utils.py +0 -0
  25. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/continuous_delivery/github.py +0 -0
  26. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/continuous_delivery/modrinth.py +0 -0
  27. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/continuous_delivery/pmc.py +0 -0
  28. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/continuous_delivery/smithed.py +0 -0
  29. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/core/__init__.py +0 -0
  30. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/core/__memory__.py +0 -0
  31. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/core/definitions_helper/__init__.py +0 -0
  32. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/core/definitions_helper/completion.py +0 -0
  33. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/core/definitions_helper/equipments.py +0 -0
  34. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/core/definitions_helper/materials.py +0 -0
  35. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/core/definitions_helper/records.py +0 -0
  36. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/core/definitions_helper/smart_ore_generation.py +0 -0
  37. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/core/definitions_helper/text.py +0 -0
  38. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/core/ingredients.py +0 -0
  39. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/core/utils/sounds.py +0 -0
  40. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/dependencies/__init__.py +0 -0
  41. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/dependencies/bookshelf.py +0 -0
  42. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/dependencies/bookshelf_config.json +0 -0
  43. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/dependencies/datapack/Bookshelf Bitwise.zip +0 -0
  44. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/dependencies/datapack/Bookshelf Block.zip +0 -0
  45. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/dependencies/datapack/Bookshelf Color.zip +0 -0
  46. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/dependencies/datapack/Bookshelf Dump.zip +0 -0
  47. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/dependencies/datapack/Bookshelf Environment.zip +0 -0
  48. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/dependencies/datapack/Bookshelf Generation.zip +0 -0
  49. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/dependencies/datapack/Bookshelf Health.zip +0 -0
  50. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/dependencies/datapack/Bookshelf Hitbox.zip +0 -0
  51. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/dependencies/datapack/Bookshelf Id.zip +0 -0
  52. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/dependencies/datapack/Bookshelf Interaction.zip +0 -0
  53. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/dependencies/datapack/Bookshelf Link.zip +0 -0
  54. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/dependencies/datapack/Bookshelf Log.zip +0 -0
  55. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/dependencies/datapack/Bookshelf Math.zip +0 -0
  56. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/dependencies/datapack/Bookshelf Move.zip +0 -0
  57. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/dependencies/datapack/Bookshelf Position.zip +0 -0
  58. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/dependencies/datapack/Bookshelf Random.zip +0 -0
  59. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/dependencies/datapack/Bookshelf Raycast.zip +0 -0
  60. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/dependencies/datapack/Bookshelf Schedule.zip +0 -0
  61. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/dependencies/datapack/Bookshelf Sidebar.zip +0 -0
  62. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/dependencies/datapack/Bookshelf Spline.zip +0 -0
  63. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/dependencies/datapack/Bookshelf String.zip +0 -0
  64. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/dependencies/datapack/Bookshelf Time.zip +0 -0
  65. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/dependencies/datapack/Bookshelf Tree.zip +0 -0
  66. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/dependencies/datapack/Bookshelf Vector.zip +0 -0
  67. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/dependencies/datapack/Bookshelf View.zip +0 -0
  68. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/dependencies/datapack/Bookshelf Xp.zip +0 -0
  69. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/plugins/auto/headers/__init__.py +0 -0
  70. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/plugins/auto/headers/object.py +0 -0
  71. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/plugins/auto/lang_file/__init__.py +0 -0
  72. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/plugins/auto/lang_file/utils.py +0 -0
  73. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/plugins/compatibilities/neo_enchant/__init__.py +0 -0
  74. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/plugins/compatibilities/simpledrawer/__init__.py +0 -0
  75. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/plugins/compute_sha1/__init__.py +0 -0
  76. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/plugins/copy_to_destination/__init__.py +0 -0
  77. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/plugins/custom_recipes/__init__.py +0 -0
  78. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/plugins/custom_recipes/furnace.py +0 -0
  79. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/plugins/custom_recipes/pulverizer.py +0 -0
  80. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/plugins/custom_recipes/smithed.py +0 -0
  81. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/plugins/custom_recipes/vanilla.py +0 -0
  82. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/plugins/datapack/custom_blocks/__init__.py +0 -0
  83. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/plugins/datapack/loading/__init__.py +0 -0
  84. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/plugins/datapack/loot_tables/__init__.py +0 -0
  85. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/plugins/finalyze/basic_datapack_structure/__init__.py +0 -0
  86. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/plugins/finalyze/check_unused_textures/__init__.py +0 -0
  87. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/plugins/finalyze/custom_blocks_ticking/__init__.py +0 -0
  88. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/plugins/finalyze/dependencies/__init__.py +0 -0
  89. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/plugins/ingame_manual/__init__.py +0 -0
  90. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/plugins/ingame_manual/assets/furnace.png +0 -0
  91. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/plugins/ingame_manual/assets/heavy_workbench.png +0 -0
  92. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/plugins/ingame_manual/assets/invisible_item.png +0 -0
  93. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/plugins/ingame_manual/assets/invisible_item_release.png +0 -0
  94. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/plugins/ingame_manual/assets/minecraft_font.ttf +0 -0
  95. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/plugins/ingame_manual/assets/none.png +0 -0
  96. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/plugins/ingame_manual/assets/none_release.png +0 -0
  97. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/plugins/ingame_manual/assets/pulverizing.png +0 -0
  98. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/plugins/ingame_manual/assets/shaped_2x2.png +0 -0
  99. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/plugins/ingame_manual/assets/shaped_3x3.png +0 -0
  100. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/plugins/ingame_manual/assets/simple_case_no_border.png +0 -0
  101. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/plugins/ingame_manual/assets/wiki_information.png +0 -0
  102. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/plugins/ingame_manual/assets/wiki_ingredient_of_craft.png +0 -0
  103. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/plugins/ingame_manual/assets/wiki_ingredient_of_craft_template.png +0 -0
  104. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/plugins/ingame_manual/assets/wiki_result_of_craft.png +0 -0
  105. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/plugins/ingame_manual/book_components.py +0 -0
  106. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/plugins/ingame_manual/book_optimizer.py +0 -0
  107. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/plugins/ingame_manual/craft_content.py +0 -0
  108. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/plugins/ingame_manual/image_utils.py +0 -0
  109. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/plugins/ingame_manual/iso_renders.py +0 -0
  110. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/plugins/ingame_manual/main.py +0 -0
  111. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/plugins/ingame_manual/other_utils.py +0 -0
  112. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/plugins/ingame_manual/page_font.py +0 -0
  113. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/plugins/ingame_manual/shared_import.py +0 -0
  114. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/plugins/ingame_manual/templates/.gitignore +0 -0
  115. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/plugins/ingame_manual/templates/_README.md +0 -0
  116. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/plugins/ingame_manual/templates/furnace.png +0 -0
  117. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/plugins/ingame_manual/templates/heavy_workbench.png +0 -0
  118. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/plugins/ingame_manual/templates/invisible_item.png +0 -0
  119. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/plugins/ingame_manual/templates/invisible_item_release.png +0 -0
  120. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/plugins/ingame_manual/templates/minecraft_font.ttf +0 -0
  121. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/plugins/ingame_manual/templates/none.png +0 -0
  122. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/plugins/ingame_manual/templates/none_release.png +0 -0
  123. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/plugins/ingame_manual/templates/pulverizing.png +0 -0
  124. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/plugins/ingame_manual/templates/shaped_2x2.png +0 -0
  125. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/plugins/ingame_manual/templates/shaped_3x3.png +0 -0
  126. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/plugins/ingame_manual/templates/simple_case_no_border.png +0 -0
  127. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/plugins/ingame_manual/templates/wiki_information.png +0 -0
  128. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/plugins/ingame_manual/templates/wiki_ingredient_of_craft.png +0 -0
  129. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/plugins/ingame_manual/templates/wiki_ingredient_of_craft_template.png +0 -0
  130. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/plugins/ingame_manual/templates/wiki_result_of_craft.png +0 -0
  131. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/plugins/ingame_manual/text_components.py +0 -0
  132. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/plugins/initialize/__init__.py +0 -0
  133. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/plugins/initialize/source_lore_font.py +0 -0
  134. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/plugins/merge_smithed_weld/__init__.py +0 -0
  135. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/plugins/merge_smithed_weld/weld.py +0 -0
  136. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/plugins/resource_pack/check_power_of_2/__init__.py +0 -0
  137. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/plugins/resource_pack/item_models/__init__.py +0 -0
  138. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/plugins/resource_pack/item_models/object.py +0 -0
  139. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/plugins/resource_pack/sounds/__init__.py +0 -0
  140. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/plugins/verify_definitions/__init__.py +0 -0
  141. {stewbeet-2.0.15 → stewbeet-2.0.16}/stewbeet/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: stewbeet
3
- Version: 2.0.15
3
+ Version: 2.0.16
4
4
  Summary: Beet Framework made to help generating advanced Minecraft datapack contents
5
5
  Project-URL: Homepage, https://github.com/Stoupy51/stewbeet
6
6
  Project-URL: Issues, https://github.com/Stoupy51/stewbeet/issues
@@ -5,7 +5,7 @@ build-backend = "hatchling.build"
5
5
 
6
6
  [project]
7
7
  name = "stewbeet"
8
- version = "2.0.15"
8
+ version = "2.0.16"
9
9
  description = "Beet Framework made to help generating advanced Minecraft datapack contents"
10
10
  readme = "README.md"
11
11
  license = "MIT"
@@ -90,12 +90,12 @@ def official_lib_used(lib: str) -> bool:
90
90
  return is_used
91
91
 
92
92
  OFFICIAL_LIBS: dict[str, dict] = {
93
- "common_signals": {"version":[0, 1, 0], "name":"Common Signals", "url":"https://github.com/Stoupy51/CommonSignals", "is_used": False},
94
- "smithed.custom_block": {"version":[0, 7, 0], "name":"Smithed Custom Block", "url":"https://wiki.smithed.dev/libraries/custom-block/", "is_used": False},
95
- "smithed.crafter": {"version":[0, 7, 0], "name":"Smithed Crafter", "url":"https://wiki.smithed.dev/libraries/crafter/", "is_used": False},
96
- "furnace_nbt_recipes": {"version":[1, 9, 0], "name":"Furnace NBT Recipes", "url":"https://github.com/Stoupy51/FurnaceNbtRecipes", "is_used": False},
97
- "smart_ore_generation": {"version":[1, 7, 1], "name":"SmartOreGeneration", "url":"https://github.com/Stoupy51/SmartOreGeneration", "is_used": False},
98
- "itemio": {"version":[1, 4, 0], "name":"ItemIO", "url":"https://github.com/edayot/ItemIO", "is_used": False},
93
+ "common_signals": {"version":[0, 1, 1], "name":"Common Signals", "url":"https://github.com/Stoupy51/CommonSignals", "is_used": False},
94
+ "smithed.custom_block": {"version":[0, 7, 1], "name":"Smithed Custom Block", "url":"https://wiki.smithed.dev/libraries/custom-block/", "is_used": False},
95
+ "smithed.crafter": {"version":[0, 7, 1], "name":"Smithed Crafter", "url":"https://wiki.smithed.dev/libraries/crafter/", "is_used": False},
96
+ "furnace_nbt_recipes": {"version":[1, 9, 1], "name":"Furnace NBT Recipes", "url":"https://github.com/Stoupy51/FurnaceNbtRecipes", "is_used": False},
97
+ "smart_ore_generation": {"version":[1, 7, 2], "name":"SmartOreGeneration", "url":"https://github.com/Stoupy51/SmartOreGeneration", "is_used": False},
98
+ "itemio": {"version":[1, 4, 1], "name":"ItemIO", "url":"https://github.com/edayot/ItemIO", "is_used": False},
99
99
  **BOOKSHELF_MODULES,
100
100
  }
101
101
 
@@ -0,0 +1,161 @@
1
+
2
+ # Imports
3
+ from typing import Any
4
+
5
+ from beet import Function, FunctionTag, JsonFile
6
+ from beet.core.utils import JsonDict
7
+ from stouputils.collections import unique_list
8
+ from stouputils.io import super_json_dump
9
+
10
+ from ..__memory__ import Mem
11
+
12
+
13
+ # Functions
14
+ def write_function_tag(path: str, functions: list[Any] | None = None, prepend: bool = False) -> None:
15
+ """ Write a function tag at the given path.
16
+
17
+ Args:
18
+ path (str): The path to the function tag (ex: "namespace:something" for 'data/namespace/tags/function/something.json')
19
+ functions (list[Any] | None): The functions to add to the tag
20
+ prepend (bool): If the functions should be prepended instead of appended
21
+ """
22
+ if path.endswith(".json"):
23
+ path = path[:-len(".json")]
24
+ tag: FunctionTag = Mem.ctx.data.function_tags.setdefault(path)
25
+ data: JsonDict = tag.data
26
+ if not data.get("values"):
27
+ data["values"] = functions or []
28
+
29
+ if prepend:
30
+ data["values"] = functions + data["values"]
31
+ else:
32
+ data["values"].extend(functions or [])
33
+ data["values"] = unique_list(data["values"])
34
+ tag.encoder = super_json_dump
35
+
36
+
37
+ def read_function(path: str) -> str:
38
+ """ Read the content of a function at the given path.
39
+
40
+ Args:
41
+ path (str): The path to the function (ex: "namespace:folder/function_name")
42
+
43
+ Returns:
44
+ str: The content of the function
45
+ """
46
+ if path.endswith(".mcfunction"):
47
+ path = path[:-len(".mcfunction")]
48
+ return Mem.ctx.data.functions[path].text
49
+
50
+
51
+ def write_function(path: str, content: str, overwrite: bool = False, prepend: bool = False, tags: list[str] | None = None) -> None:
52
+ """ Write the content to the function at the given path.
53
+
54
+ Args:
55
+ path (str): The path to the function (ex: "namespace:folder/function_name")
56
+ content (str): The content to write
57
+ overwrite (bool): If the file should be overwritten (default: Append the content)
58
+ prepend (bool): If the content should be prepended instead of appended (not used if overwrite is True)
59
+ tags (list[str] | None): The function tags to add to the function (ex: ["namespace:something"] for 'data/namespace/tags/function/something.json')
60
+ """
61
+ if path.endswith(".mcfunction"):
62
+ path = path[:-len(".mcfunction")]
63
+ if overwrite:
64
+ Mem.ctx.data.functions[path] = Function(content)
65
+ else:
66
+ if prepend:
67
+ Mem.ctx.data.functions.setdefault(path).prepend(content)
68
+ else:
69
+ Mem.ctx.data.functions.setdefault(path).append(content)
70
+ if tags:
71
+ for tag in tags:
72
+ write_function_tag(tag, [path], prepend)
73
+
74
+
75
+ def write_load_file(content: str, overwrite: bool = False, prepend: bool = False, tags: list[str] | None = None) -> None:
76
+ """ Write the content to the load file
77
+
78
+ Args:
79
+ content (str): The content to write
80
+ overwrite (bool): If the file should be overwritten (default: Append the content)
81
+ prepend (bool): If the content should be prepended instead of appended (not used if overwrite is True)
82
+ tags (list[str] | None): The function tags to add to the function (ex: ["namespace:something"] for 'data/namespace/tags/function/something.json')
83
+ """
84
+ write_function(f"{Mem.ctx.project_id}:v{Mem.ctx.project_version}/load/confirm_load", content, overwrite, prepend, tags)
85
+
86
+
87
+ def write_tick_file(content: str, overwrite: bool = False, prepend: bool = False, tags: list[str] | None = None) -> None:
88
+ """ Write the content to the tick file
89
+
90
+ Args:
91
+ content (str): The content to write
92
+ overwrite (bool): If the file should be overwritten (default: Append the content)
93
+ prepend (bool): If the content should be prepended instead of appended (not used if overwrite is True)
94
+ tags (list[str] | None): The function tags to add to the function (ex: ["namespace:something"] for 'data/namespace/tags/function/something.json')
95
+ """
96
+ write_function(f"{Mem.ctx.project_id}:v{Mem.ctx.project_version}/tick", content, overwrite, prepend, tags)
97
+
98
+
99
+ def write_versioned_function(path: str, content: str, overwrite: bool = False, prepend: bool = False, tags: list[str] | None = None) -> None:
100
+ """ Write the content to a versioned function at the given path.
101
+
102
+ Args:
103
+ path (str): The path to the function (ex: "folder/function_name")
104
+ content (str): The content to write
105
+ overwrite (bool): If the file should be overwritten (default: Append the content)
106
+ prepend (bool): If the content should be prepended instead of appended (not used if overwrite is True)
107
+ tags (list[str] | None): The function tags to add to the function (ex: ["namespace:something"] for 'data/namespace/tags/function/something.json')
108
+ """
109
+ write_function(f"{Mem.ctx.project_id}:v{Mem.ctx.project_version}/{path}", content, overwrite, prepend, tags)
110
+
111
+
112
+ # Merge two dict recuirsively
113
+ def super_merge_dict(dict1: dict, dict2: dict) -> dict:
114
+ """ Merge the two dictionnaries recursively without modifying originals
115
+ Args:
116
+ dict1 (dict): The first dictionnary
117
+ dict2 (dict): The second dictionnary
118
+ Returns:
119
+ dict: The merged dictionnary
120
+ """
121
+ # Copy first dictionnary
122
+ new_dict = {}
123
+ for key, value in dict1.items():
124
+ new_dict[key] = value
125
+
126
+ # For each key of the second dictionnary,
127
+ for key, value in dict2.items():
128
+
129
+ # If key exists in dict1, and both values are also dict, merge recursively
130
+ if key in dict1 and isinstance(dict1[key], dict) and isinstance(value, dict):
131
+ new_dict[key] = super_merge_dict(dict1[key], value)
132
+
133
+ # Else if it's a list, merge it
134
+ elif key in dict1 and isinstance(dict1[key], list) and isinstance(value, list):
135
+ new_dict[key] = dict1[key] + value
136
+ if not any(isinstance(x, dict) for x in new_dict[key]):
137
+ new_dict[key] = unique_list(new_dict[key])
138
+
139
+ # Else, just overwrite or add value
140
+ else:
141
+ new_dict[key] = value
142
+
143
+ # Return the new dict
144
+ return new_dict
145
+
146
+ def set_json_encoder(obj: JsonFile, max_level: int | None = None, indent: str | int = '\t') -> JsonFile:
147
+ """ Set the encoder of the given object to super_json_dump
148
+
149
+ Args:
150
+ obj (JsonFile): The object to set the encoder for
151
+ max_level (int | None): The maximum level of the JSON dump, or None for default behavior
152
+ indent (str | int): The indentation character (default: '\t')
153
+ Returns:
154
+ JsonFile: The object with the encoder set
155
+ """
156
+ if max_level is None:
157
+ obj.encoder = lambda x: super_json_dump(x, indent=indent)
158
+ else:
159
+ obj.encoder = lambda x: super_json_dump(x, max_level=max_level, indent=indent)
160
+ return obj
161
+
@@ -10,6 +10,8 @@ from stouputils.decorators import handle_error, measure_time
10
10
  from stouputils.parallel import multithreading
11
11
  from stouputils.print import progress
12
12
 
13
+ from ..initialize.source_lore_font import find_pack_png
14
+
13
15
 
14
16
  def get_consistent_timestamp(ctx: Context) -> tuple[int, ...]:
15
17
  """ Get a consistent timestamp for archive files based on beet cache .gitignore file modification time. """
@@ -87,6 +89,15 @@ def beet_default(ctx: Context) -> None:
87
89
  info.compress_type = zipfile.ZIP_DEFLATED
88
90
  final_zip.writestr(info, content)
89
91
 
92
+ # Check if pack.png exists and add it to the final zip if it does
93
+ pack_png_path = find_pack_png()
94
+ if pack_png_path:
95
+ info = ZipInfo("pack.png")
96
+ info.compress_type = zipfile.ZIP_DEFLATED
97
+ info.date_time = consistent_time
98
+ with open(pack_png_path, "rb") as f:
99
+ final_zip.writestr(info, f.read())
100
+
90
101
  # Process each pack in parallel
91
102
  multithreading(handle_pack, ctx.packs, max_workers=len(ctx.packs))
92
103
 
@@ -1,136 +0,0 @@
1
-
2
- # Imports
3
- from typing import Any
4
-
5
- from beet import Function, FunctionTag
6
- from beet.core.utils import JsonDict
7
- from stouputils.collections import unique_list
8
- from stouputils.io import super_json_dump
9
-
10
- from ..__memory__ import Mem
11
-
12
-
13
- # Functions
14
- def write_function_tag(path: str, functions: list[Any] | None = None, prepend: bool = False) -> None:
15
- """ Write a function tag at the given path.
16
-
17
- Args:
18
- path (str): The path to the function tag (ex: "namespace:something" for 'data/namespace/tags/function/something.json')
19
- functions (list[Any] | None): The functions to add to the tag
20
- prepend (bool): If the functions should be prepended instead of appended
21
- """
22
- tag: FunctionTag = Mem.ctx.data.function_tags.setdefault(path)
23
- data: JsonDict = tag.data
24
- if not data.get("values"):
25
- data["values"] = functions or []
26
-
27
- if prepend:
28
- data["values"] = functions + data["values"]
29
- else:
30
- data["values"].extend(functions or [])
31
- data["values"] = unique_list(data["values"])
32
- tag.encoder = super_json_dump
33
-
34
-
35
- def read_function(path: str) -> str:
36
- """ Read the content of a function at the given path.
37
-
38
- Args:
39
- path (str): The path to the function (ex: "namespace:folder/function_name")
40
-
41
- Returns:
42
- str: The content of the function
43
- """
44
- return Mem.ctx.data.functions[path].text
45
-
46
-
47
- def write_function(path: str, content: str, overwrite: bool = False, prepend: bool = False, tags: list[str] | None = None) -> None:
48
- """ Write the content to the function at the given path.
49
-
50
- Args:
51
- path (str): The path to the function (ex: "namespace:folder/function_name")
52
- content (str): The content to write
53
- overwrite (bool): If the file should be overwritten (default: Append the content)
54
- prepend (bool): If the content should be prepended instead of appended (not used if overwrite is True)
55
- tags (list[str] | None): The function tags to add to the function (ex: ["namespace:something"] for 'data/namespace/tags/function/something.json')
56
- """
57
- if overwrite:
58
- Mem.ctx.data.functions[path] = Function(content)
59
- else:
60
- if prepend:
61
- Mem.ctx.data.functions.setdefault(path).prepend(content)
62
- else:
63
- Mem.ctx.data.functions.setdefault(path).append(content)
64
- if tags:
65
- for tag in tags:
66
- write_function_tag(tag, [path], prepend)
67
-
68
-
69
- def write_load_file(content: str, overwrite: bool = False, prepend: bool = False) -> None:
70
- """ Write the content to the load file
71
-
72
- Args:
73
- content (str): The content to write
74
- overwrite (bool): If the file should be overwritten (default: Append the content)
75
- prepend (bool): If the content should be prepended instead of appended (not used if overwrite is True)
76
- """
77
- write_function(f"{Mem.ctx.project_id}:v{Mem.ctx.project_version}/load/confirm_load", content, overwrite, prepend)
78
-
79
-
80
- def write_tick_file(content: str, overwrite: bool = False, prepend: bool = False) -> None:
81
- """ Write the content to the tick file
82
-
83
- Args:
84
- content (str): The content to write
85
- overwrite (bool): If the file should be overwritten (default: Append the content)
86
- prepend (bool): If the content should be prepended instead of appended (not used if overwrite is True)
87
- """
88
- write_function(f"{Mem.ctx.project_id}:v{Mem.ctx.project_version}/tick", content, overwrite, prepend)
89
-
90
-
91
- def write_versioned_function(path: str, content: str, overwrite: bool = False, prepend: bool = False) -> None:
92
- """ Write the content to a versioned function at the given path.
93
-
94
- Args:
95
- path (str): The path to the function (ex: "folder/function_name")
96
- content (str): The content to write
97
- overwrite (bool): If the file should be overwritten (default: Append the content)
98
- prepend (bool): If the content should be prepended instead of appended (not used if overwrite is True)
99
- """
100
- write_function(f"{Mem.ctx.project_id}:v{Mem.ctx.project_version}/{path}", content, overwrite, prepend)
101
-
102
-
103
- # Merge two dict recuirsively
104
- def super_merge_dict(dict1: dict, dict2: dict) -> dict:
105
- """ Merge the two dictionnaries recursively without modifying originals
106
- Args:
107
- dict1 (dict): The first dictionnary
108
- dict2 (dict): The second dictionnary
109
- Returns:
110
- dict: The merged dictionnary
111
- """
112
- # Copy first dictionnary
113
- new_dict = {}
114
- for key, value in dict1.items():
115
- new_dict[key] = value
116
-
117
- # For each key of the second dictionnary,
118
- for key, value in dict2.items():
119
-
120
- # If key exists in dict1, and both values are also dict, merge recursively
121
- if key in dict1 and isinstance(dict1[key], dict) and isinstance(value, dict):
122
- new_dict[key] = super_merge_dict(dict1[key], value)
123
-
124
- # Else if it's a list, merge it
125
- elif key in dict1 and isinstance(dict1[key], list) and isinstance(value, list):
126
- new_dict[key] = dict1[key] + value
127
- if not any(isinstance(x, dict) for x in new_dict[key]):
128
- new_dict[key] = unique_list(new_dict[key])
129
-
130
- # Else, just overwrite or add value
131
- else:
132
- new_dict[key] = value
133
-
134
- # Return the new dict
135
- return new_dict
136
-
File without changes
File without changes
File without changes
File without changes