minecraft-datapack-language 15.4.28__py3-none-any.whl → 15.4.29__py3-none-any.whl

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.
Files changed (27) hide show
  1. minecraft_datapack_language/__init__.py +17 -2
  2. minecraft_datapack_language/_version.py +2 -2
  3. minecraft_datapack_language/ast_nodes.py +87 -59
  4. minecraft_datapack_language/mdl_compiler.py +470 -0
  5. minecraft_datapack_language/mdl_errors.py +14 -0
  6. minecraft_datapack_language/mdl_lexer.py +624 -0
  7. minecraft_datapack_language/mdl_parser.py +573 -0
  8. minecraft_datapack_language-15.4.29.dist-info/METADATA +266 -0
  9. minecraft_datapack_language-15.4.29.dist-info/RECORD +16 -0
  10. minecraft_datapack_language/cli.py +0 -159
  11. minecraft_datapack_language/cli_build.py +0 -1292
  12. minecraft_datapack_language/cli_check.py +0 -155
  13. minecraft_datapack_language/cli_colors.py +0 -264
  14. minecraft_datapack_language/cli_help.py +0 -508
  15. minecraft_datapack_language/cli_new.py +0 -300
  16. minecraft_datapack_language/cli_utils.py +0 -276
  17. minecraft_datapack_language/expression_processor.py +0 -352
  18. minecraft_datapack_language/linter.py +0 -409
  19. minecraft_datapack_language/mdl_lexer_js.py +0 -754
  20. minecraft_datapack_language/mdl_parser_js.py +0 -1049
  21. minecraft_datapack_language/pack.py +0 -758
  22. minecraft_datapack_language-15.4.28.dist-info/METADATA +0 -1274
  23. minecraft_datapack_language-15.4.28.dist-info/RECORD +0 -25
  24. {minecraft_datapack_language-15.4.28.dist-info → minecraft_datapack_language-15.4.29.dist-info}/WHEEL +0 -0
  25. {minecraft_datapack_language-15.4.28.dist-info → minecraft_datapack_language-15.4.29.dist-info}/entry_points.txt +0 -0
  26. {minecraft_datapack_language-15.4.28.dist-info → minecraft_datapack_language-15.4.29.dist-info}/licenses/LICENSE +0 -0
  27. {minecraft_datapack_language-15.4.28.dist-info → minecraft_datapack_language-15.4.29.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,266 @@
1
+ Metadata-Version: 2.4
2
+ Name: minecraft-datapack-language
3
+ Version: 15.4.29
4
+ Summary: Compile MDL language with explicit scoping into a Minecraft datapack (1.21+ ready). Features variables, control flow, error handling, and VS Code extension.
5
+ Project-URL: Homepage, https://www.mcmdl.com
6
+ Project-URL: Documentation, https://www.mcmdl.com/docs
7
+ Project-URL: Repository, https://github.com/aaron777collins/MinecraftDatapackLanguage
8
+ Project-URL: Bug Tracker, https://github.com/aaron777collins/MinecraftDatapackLanguage/issues
9
+ Project-URL: VS Code Extension, https://marketplace.visualstudio.com/items?itemName=mdl.minecraft-datapack-language
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Operating System :: OS Independent
13
+ Requires-Python: >=3.9
14
+ Description-Content-Type: text/markdown
15
+ License-File: LICENSE
16
+ Requires-Dist: mecha>=0.99.0
17
+ Provides-Extra: dev
18
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
19
+ Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
20
+ Dynamic: license-file
21
+
22
+ # <img src="https://github.com/aaron777collins/MinecraftDatapackLanguage/raw/main/icons/icon-128.png" width="32" height="32" alt="MDL Icon"> Minecraft Datapack Language (MDL)
23
+
24
+ A **modern, scope-aware language** that lets you write Minecraft datapacks with **explicit scoping, variables, control structures, and expressions** that actually work.
25
+
26
+ 📖 **[View Full Documentation](https://www.mcmdl.com/)** - Complete guides, examples, and API reference
27
+ 📦 **[View on PyPI](https://pypi.org/project/minecraft-datapack-language/)** - Download and install from PyPI
28
+ 🔧 **[VS Code Extension](https://marketplace.visualstudio.com/items?itemName=mdl.minecraft-datapack-language)** - Syntax highlighting, IntelliSense, and snippets
29
+
30
+ ![CI](https://github.com/aaron777collins/MinecraftDatapackLanguage/workflows/CI/badge.svg)
31
+ ![Test Examples](https://github.com/aaron777collins/MinecraftDatapackLanguage/workflows/Test%20Examples/badge.svg)
32
+ ![Documentation](https://github.com/aaron777collins/MinecraftDatapackLanguage/workflows/Build%20and%20Deploy%20Documentation/badge.svg)
33
+ ![PyPI](https://img.shields.io/pypi/v/minecraft-datapack-language?style=flat-square)
34
+ ![Release](https://github.com/aaron777collins/MinecraftDatapackLanguage/workflows/Release/badge.svg)
35
+
36
+ ## 🎯 **MODERN** MDL Language with Explicit Scoping
37
+
38
+ **MDL uses a modern, scope-aware language format** with **explicit scoping, control structures, variables, and expressions**:
39
+
40
+ ### ✨ **MODERN** Features
41
+ - **🎯 Explicit scoping** with angle brackets `<@s>`, `<@a[team=red]>` for all operations
42
+ - **📝 Modern comments** using `//` and `/* */`
43
+ - **🔢 Number variables** with `var num` type (stored in scoreboards)
44
+ - **🔄 Full control structures** including `if/else`, `while` loops
45
+ - **💲 Variable substitution** with `$variable<scope>$` syntax
46
+ - **🧮 Expressions** with arithmetic operations (`+`, `-`, `*`, `/`)
47
+ - **📦 Namespace system** for modular code organization
48
+ - **🏷️ Tag system** for all datapack resources (recipes, loot tables, advancements, etc.)
49
+ - **🎨 VS Code extension** with full IntelliSense and snippets
50
+ - **🧪 Comprehensive testing** with E2E validation
51
+ - **📚 Extensive documentation** with examples for every feature
52
+
53
+ ### 🏗️ Core Features
54
+ - ✅ **Modern pack format 15** by default for latest Minecraft features
55
+ - ✅ **Explicit scoping** - every variable operation specifies its scope
56
+ - ✅ **Real control structures** - `if/else`, `while` loops
57
+ - ✅ **Number variables** stored in scoreboards with `$variable<scope>$` substitution
58
+ - ✅ **Expressions** with arithmetic operations and variable substitution
59
+ - ✅ **Multi-file projects** with automatic merging and dependency resolution
60
+ - ✅ **Variable optimization** - automatic load function generation for initialization
61
+ - ✅ **Selector optimization** - proper `@a` usage for system commands
62
+ - ✅ **Easy hooks** into `minecraft:tick` and `minecraft:load` via function tags
63
+ - ✅ **Tag support** for `recipe`, `loot_table`, `advancement`, `item_modifier`, `predicate`, and `structure`
64
+ - ✅ **Raw blocks** for direct Minecraft command injection
65
+ - ✅ **Say commands** that auto-convert to `tellraw` with JSON formatting
66
+
67
+ > **Note**: Version 1.0+ uses **pack_format 15** by default for the modern MDL syntax.
68
+
69
+ ---
70
+
71
+ ## 🚀 Install
72
+
73
+ ### Option A — from PyPI (recommended for users)
74
+ Global, isolated CLI via **pipx**:
75
+ ```bash
76
+ python3 -m pip install --user pipx
77
+ python3 -m pipx ensurepath # reopen terminal
78
+ pipx install minecraft-datapack-language
79
+
80
+ mdl --help
81
+ ```
82
+
83
+ Virtualenv (if you prefer):
84
+ ```bash
85
+ python3 -m venv .venv
86
+ source .venv/bin/activate # Windows: .\.venv\Scripts\Activate.ps1
87
+ pip install minecraft-datapack-language
88
+ ```
89
+
90
+ ### Option B — from source (for contributors)
91
+ ```bash
92
+ # inside the repo
93
+ python -m pip install -e .
94
+ ```
95
+
96
+ ---
97
+
98
+ ## 🔄 Update
99
+
100
+ - **pipx**: `pipx upgrade minecraft-datapack-language`
101
+ - **pip (venv)**: `pip install -U minecraft-datapack-language`
102
+ - Pin a version: `pipx install "minecraft-datapack-language==<version>"` (replace `<version>` with desired version)
103
+
104
+ ---
105
+
106
+ ## 💻 CLI
107
+
108
+ ### Modern MDL (v1.0+)
109
+ ```bash
110
+ # Build MDL files
111
+ mdl build --mdl my_pack/mypack.mdl -o dist --wrapper mypack
112
+ mdl check my_pack/mypack.mdl
113
+
114
+ # Validate generated mcfunction files
115
+ mdl check my_pack/mypack.mdl
116
+
117
+ # Multi-file projects
118
+ mdl build --mdl my_pack/ -o dist # Build entire directory
119
+ mdl build --mdl "file1.mdl file2.mdl" -o dist # Build specific files
120
+
121
+ # Create new projects
122
+ mdl new my_awesome_pack
123
+ ```
124
+
125
+ ### Quick Start
126
+ ```bash
127
+ # Create a new project
128
+ mdl new my_first_pack
129
+
130
+ # Build it
131
+ cd my_first_pack
132
+ mdl build --mdl main.mdl -o dist
133
+
134
+ # Check for errors
135
+ mdl check main.mdl
136
+ ```
137
+
138
+ ---
139
+
140
+ ## 📝 Language Examples
141
+
142
+ ### Basic Structure
143
+ ```mdl
144
+ pack "MyPack" "My awesome datapack" 15;
145
+ namespace "game";
146
+
147
+ var num player_score<@s> = 0;
148
+ var num team_score<@a[team=red]> = 0;
149
+
150
+ function game:start<@s> {
151
+ player_score<@s> = 100;
152
+ say "Welcome! Your score is $player_score<@s>$";
153
+ }
154
+
155
+ on_load game:start<@s>;
156
+ ```
157
+
158
+ ### Control Structures
159
+ ```mdl
160
+ function game:check_score<@s> {
161
+ if $player_score<@s>$ > 10 {
162
+ say "Great score!";
163
+ player_score<@s> = $player_score<@s>$ + 5;
164
+ } else {
165
+ say "Keep trying!";
166
+ }
167
+
168
+ while $player_score<@s>$ < 100 {
169
+ player_score<@s> = $player_score<@s>$ + 1;
170
+ }
171
+ }
172
+ ```
173
+
174
+ ### Tags and Resources
175
+ ```mdl
176
+ // Recipe tags
177
+ tag recipe "diamond_sword" "recipes/diamond_sword.json";
178
+ tag loot_table "epic_loot" "loot_tables/epic_loot.json";
179
+ tag advancement "first_spell" "advancements/first_spell.json";
180
+
181
+ // Item modifiers and predicates
182
+ tag item_modifier "enchanted_tool" "item_modifiers/enchanted_tool.json";
183
+ tag predicate "has_mana" "predicates/has_mana.json";
184
+ tag structure "wizard_tower" "structures/wizard_tower.json";
185
+ ```
186
+
187
+ ### Raw Blocks and Say Commands
188
+ ```mdl
189
+ function game:special_effect<@s> {
190
+ $!raw
191
+ execute as @s run particle minecraft:explosion ~ ~ ~ 1 1 1 0 10
192
+ execute as @s run playsound minecraft:entity.player.levelup player @s ~ ~ ~ 1 1
193
+ raw!$
194
+
195
+ say "Special effect triggered! Score: $player_score<@s>$";
196
+ }
197
+ ```
198
+
199
+ ---
200
+
201
+ ## 🔧 Development
202
+
203
+ ### Building from Source
204
+ ```bash
205
+ git clone https://github.com/aaron777collins/MinecraftDatapackLanguage.git
206
+ cd MinecraftDatapackLanguage
207
+ python -m pip install -e .
208
+ ```
209
+
210
+ ### Running Tests
211
+ ```bash
212
+ # Run all tests
213
+ python -m pytest
214
+
215
+ # Run specific test file
216
+ python -m pytest test_comprehensive_end_to_end.py
217
+
218
+ # Run with coverage
219
+ python -m pytest --cov=minecraft_datapack_language
220
+ ```
221
+
222
+ ### Building the Extension
223
+ ```bash
224
+ cd vscode-extension
225
+ npm install
226
+ npm run compile
227
+ ```
228
+
229
+ ---
230
+
231
+ ## 📚 Documentation
232
+
233
+ - **[Language Reference](docs/_docs/language-reference.md)** - Complete language specification
234
+ - **[VS Code Extension](vscode-extension/README.md)** - Extension documentation
235
+ - **[Examples](examples/)** - Sample projects and code snippets
236
+
237
+ ---
238
+
239
+ ## 🤝 Contributing
240
+
241
+ We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.
242
+
243
+ ### Development Setup
244
+ 1. Fork the repository
245
+ 2. Create a feature branch
246
+ 3. Make your changes
247
+ 4. Add tests for new functionality
248
+ 5. Submit a pull request
249
+
250
+ ---
251
+
252
+ ## 📄 License
253
+
254
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
255
+
256
+ ---
257
+
258
+ ## 🙏 Acknowledgments
259
+
260
+ - Minecraft community for inspiration
261
+ - Contributors and testers
262
+ - VS Code team for the excellent extension API
263
+
264
+ ---
265
+
266
+ **Happy coding with MDL! 🎮**
@@ -0,0 +1,16 @@
1
+ minecraft_datapack_language/__init__.py,sha256=c5k0fBKRAxF0557G2v-cYEIlWMenxpZvqF4Vc-a2h_w,1020
2
+ minecraft_datapack_language/_version.py,sha256=rnQ_6GFc2eBI-vGa-wlHgmkGjEcl6g4Z2WASG1ABT3g,708
3
+ minecraft_datapack_language/ast_nodes.py,sha256=nbWrRz137MGMRpmnq8QkXNzrtlaCgyPEknytbkrS_M8,3899
4
+ minecraft_datapack_language/dir_map.py,sha256=HmxFkuvWGkzHF8o_GFb4BpuMCRc6QMw8UbmcAI8JVdY,1788
5
+ minecraft_datapack_language/mdl_compiler.py,sha256=GQv2CD29aj8vxhqRczTn_2JjNn6hiHQ4XoU2qh-s1n4,20429
6
+ minecraft_datapack_language/mdl_errors.py,sha256=r0Gu3KhoX1YLPAVW_iO7Q_fPgaf_Dv9tOGSOdKNSzmw,16114
7
+ minecraft_datapack_language/mdl_lexer.py,sha256=CjbEUpuuF4eU_ucA_WIhw6wSMcHGk2BchtQ0bLAGvwg,22033
8
+ minecraft_datapack_language/mdl_linter.py,sha256=z85xoAglENurCh30bR7kEHZ_JeMxcYaLDcGNRAl-RAI,17253
9
+ minecraft_datapack_language/mdl_parser.py,sha256=aQPKcmATM9BOMzO7vCXmMdxU1qjOJNLCSAKJopu5h3g,23429
10
+ minecraft_datapack_language/utils.py,sha256=Aq0HAGlXqj9BUTEjaEilpvzEW0EtZYYMMwOqG9db6dE,684
11
+ minecraft_datapack_language-15.4.29.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
12
+ minecraft_datapack_language-15.4.29.dist-info/METADATA,sha256=NtDozp6aH8Laa8M8Dh9uWw7mt3EtqTK9QQQdaFImcT8,8475
13
+ minecraft_datapack_language-15.4.29.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
14
+ minecraft_datapack_language-15.4.29.dist-info/entry_points.txt,sha256=c6vjBeCiyQflvPHBRyBk2nJCSfYt3Oc7Sc9V87ySi_U,108
15
+ minecraft_datapack_language-15.4.29.dist-info/top_level.txt,sha256=ADtFI476tbKLLxEAA-aJQAfg53MA3k_DOb0KTFiggfw,28
16
+ minecraft_datapack_language-15.4.29.dist-info/RECORD,,
@@ -1,159 +0,0 @@
1
- """
2
- MDL CLI - Simplified Minecraft Datapack Language Compiler
3
- Handles basic control structures and number variables only
4
- """
5
-
6
- import argparse
7
- import sys
8
- from pathlib import Path
9
- from typing import Optional
10
-
11
- from .cli_build import build_mdl
12
- from .cli_check import lint_mdl_file_wrapper, lint_mdl_directory_wrapper
13
- from .cli_new import create_new_project
14
- from .cli_help import show_main_help, show_build_help, show_check_help, show_new_help
15
- from .mdl_errors import MDLErrorCollector, create_error, MDLConfigurationError
16
-
17
-
18
- def main():
19
- """Main CLI entry point."""
20
- error_collector = MDLErrorCollector()
21
-
22
- try:
23
- # Check for help requests and determine command first
24
- has_help = '--help' in sys.argv or '-h' in sys.argv
25
-
26
- # Determine which command is being used for help
27
- help_command = None
28
- if has_help:
29
- for i, arg in enumerate(sys.argv[1:], 1):
30
- if arg in ['build', 'check', 'new']:
31
- help_command = arg
32
- break
33
-
34
- # Handle command-specific help before any parsing
35
- if has_help and help_command == 'build':
36
- show_build_help()
37
- return
38
- elif has_help and help_command == 'check':
39
- show_check_help()
40
- return
41
- elif has_help and help_command == 'new':
42
- show_new_help()
43
- return
44
- elif has_help:
45
- # General help request
46
- show_main_help()
47
- return
48
-
49
- # Create argument parser without built-in help
50
- parser = argparse.ArgumentParser(
51
- description="MDL (Minecraft Datapack Language) CLI",
52
- add_help=False
53
- )
54
-
55
- # Add subcommands
56
- subparsers = parser.add_subparsers(dest='command', help='Available commands')
57
-
58
- # Build command
59
- build_parser = subparsers.add_parser('build', add_help=False)
60
- build_parser.add_argument('--mdl', '-m', required=True, help='Input MDL file or directory')
61
- build_parser.add_argument('-o', '--output', required=True, help='Output directory')
62
- build_parser.add_argument('--verbose', '-v', action='store_true', help='Verbose output')
63
- build_parser.add_argument('--pack-format', type=int, help='Pack format override')
64
- build_parser.add_argument('--wrapper', help='Create zip file with specified name')
65
- build_parser.add_argument('--ignore-warnings', action='store_true', help='Suppress warning messages during build')
66
-
67
- # Check command
68
- check_parser = subparsers.add_parser('check', add_help=False)
69
- check_parser.add_argument('input', help='Input MDL file or directory')
70
- check_parser.add_argument('--verbose', '-v', action='store_true', help='Verbose output')
71
- check_parser.add_argument('--ignore-warnings', action='store_true', help='Suppress warning messages during check')
72
-
73
- # New command
74
- new_parser = subparsers.add_parser('new', add_help=False)
75
- new_parser.add_argument('project_name', help='Name for the new project')
76
- new_parser.add_argument('--pack-name', help='Custom pack name')
77
- new_parser.add_argument('--pack-format', type=int, default=82, help='Pack format number')
78
-
79
- try:
80
- args = parser.parse_args()
81
- except SystemExit:
82
- # Invalid arguments - show help
83
- show_main_help()
84
- return
85
-
86
- # Process commands
87
- if args.command == "build":
88
- try:
89
- build_mdl(
90
- args.mdl,
91
- args.output,
92
- verbose=args.verbose,
93
- pack_format_override=args.pack_format,
94
- wrapper=args.wrapper,
95
- ignore_warnings=args.ignore_warnings
96
- )
97
- except Exception as e:
98
- error_collector.add_error(create_error(
99
- MDLConfigurationError,
100
- f"Build command failed: {str(e)}",
101
- suggestion="Check your arguments and try again."
102
- ))
103
-
104
- elif args.command == "check":
105
- try:
106
- input_path = Path(args.input)
107
- if input_path.is_file():
108
- lint_mdl_file_wrapper(args.input, args.verbose, args.ignore_warnings)
109
- else:
110
- lint_mdl_directory_wrapper(args.input, args.verbose, args.ignore_warnings)
111
- except Exception as e:
112
- error_collector.add_error(create_error(
113
- MDLConfigurationError,
114
- f"Check command failed: {str(e)}",
115
- suggestion="Check your arguments and try again."
116
- ))
117
-
118
- elif args.command == "new":
119
- try:
120
- create_new_project(
121
- args.project_name,
122
- pack_name=args.pack_name,
123
- pack_format=args.pack_format
124
- )
125
- except Exception as e:
126
- error_collector.add_error(create_error(
127
- MDLConfigurationError,
128
- f"New command failed: {str(e)}",
129
- suggestion="Check your arguments and try again."
130
- ))
131
-
132
- elif args.command is None:
133
- # No command specified - show help
134
- show_main_help()
135
- return
136
- else:
137
- # Unknown command
138
- error_collector.add_error(create_error(
139
- MDLConfigurationError,
140
- f"Unknown command: {args.command}",
141
- suggestion="Use 'mdl --help' to see available commands."
142
- ))
143
-
144
- # Print any errors and exit
145
- error_collector.print_errors(verbose=True, ignore_warnings=False)
146
- error_collector.raise_if_errors()
147
-
148
- except Exception as e:
149
- error_collector.add_error(create_error(
150
- MDLConfigurationError,
151
- f"Unexpected error: {str(e)}",
152
- suggestion="If this error persists, please report it as a bug."
153
- ))
154
- error_collector.print_errors(verbose=True, ignore_warnings=False)
155
- error_collector.raise_if_errors()
156
-
157
-
158
- if __name__ == "__main__":
159
- main()