minecraft-datapack-language 15.4.8__py3-none-any.whl → 15.4.10__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.
- minecraft_datapack_language/_version.py +2 -2
- minecraft_datapack_language/cli_build.py +11 -11
- minecraft_datapack_language/cli_help.py +561 -370
- minecraft_datapack_language/cli_new.py +129 -41
- minecraft_datapack_language/mdl_errors.py +227 -139
- {minecraft_datapack_language-15.4.8.dist-info → minecraft_datapack_language-15.4.10.dist-info}/METADATA +1 -1
- {minecraft_datapack_language-15.4.8.dist-info → minecraft_datapack_language-15.4.10.dist-info}/RECORD +11 -11
- {minecraft_datapack_language-15.4.8.dist-info → minecraft_datapack_language-15.4.10.dist-info}/WHEEL +0 -0
- {minecraft_datapack_language-15.4.8.dist-info → minecraft_datapack_language-15.4.10.dist-info}/entry_points.txt +0 -0
- {minecraft_datapack_language-15.4.8.dist-info → minecraft_datapack_language-15.4.10.dist-info}/licenses/LICENSE +0 -0
- {minecraft_datapack_language-15.4.8.dist-info → minecraft_datapack_language-15.4.10.dist-info}/top_level.txt +0 -0
@@ -2,12 +2,6 @@
|
|
2
2
|
CLI Help System - Comprehensive help documentation for MDL CLI
|
3
3
|
"""
|
4
4
|
|
5
|
-
from .cli_colors import (
|
6
|
-
print_header, print_title, print_section, print_separator,
|
7
|
-
print_success, print_warning, print_info, print_bullet,
|
8
|
-
print_code, color
|
9
|
-
)
|
10
|
-
|
11
5
|
|
12
6
|
def show_main_help():
|
13
7
|
"""Display the main help message for the MDL CLI."""
|
@@ -17,381 +11,578 @@ def show_main_help():
|
|
17
11
|
except ImportError:
|
18
12
|
version = "unknown"
|
19
13
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
print_bullet("Language Reference: https://www.mcmdl.com/docs/language-reference")
|
77
|
-
print_bullet("CLI Reference: https://www.mcmdl.com/docs/cli-reference")
|
78
|
-
print_bullet("Examples: https://www.mcmdl.com/docs/examples")
|
79
|
-
print()
|
80
|
-
|
81
|
-
print_section("Error Reporting")
|
82
|
-
print()
|
83
|
-
|
84
|
-
print_info("MDL provides detailed error messages with:")
|
85
|
-
print_bullet("Exact file location (line, column)")
|
86
|
-
print_bullet("Context lines showing the problematic code")
|
87
|
-
print_bullet("Helpful suggestions for fixing issues")
|
88
|
-
print_bullet("Multiple error collection and reporting")
|
89
|
-
print()
|
90
|
-
|
91
|
-
print_info("For support and bug reports, visit:")
|
92
|
-
print_code("https://github.com/aaron777collins/MinecraftDatapackLanguage")
|
14
|
+
print(f"""
|
15
|
+
[GAME] MDL (Minecraft Datapack Language) CLI - v{version}
|
16
|
+
====================================================
|
17
|
+
|
18
|
+
MDL is a simplified language for creating Minecraft datapacks with variables,
|
19
|
+
control structures, and easy syntax. This CLI tool compiles MDL files into
|
20
|
+
standard Minecraft datapacks.
|
21
|
+
|
22
|
+
[CMD] Available Commands:
|
23
|
+
=====================
|
24
|
+
|
25
|
+
[BUILD] build - Compile MDL files into a Minecraft datapack
|
26
|
+
[CHECK] check - Validate MDL files for syntax and semantic errors
|
27
|
+
[NEW] new - Create a new MDL project with template files
|
28
|
+
|
29
|
+
[DOC] Detailed Help:
|
30
|
+
================
|
31
|
+
|
32
|
+
For detailed information about any command, use:
|
33
|
+
mdl <command> --help
|
34
|
+
|
35
|
+
Examples:
|
36
|
+
mdl build --help - Show build command options
|
37
|
+
mdl check --help - Show check command options
|
38
|
+
mdl new --help - Show new project options
|
39
|
+
|
40
|
+
[NEXT] Quick Start:
|
41
|
+
==============
|
42
|
+
|
43
|
+
1. Create a new project:
|
44
|
+
mdl new my_project
|
45
|
+
|
46
|
+
2. Build your datapack:
|
47
|
+
mdl build --mdl my_project.mdl -o dist
|
48
|
+
|
49
|
+
3. Check for errors:
|
50
|
+
mdl check my_project.mdl
|
51
|
+
|
52
|
+
[INFO] Documentation:
|
53
|
+
================
|
54
|
+
|
55
|
+
• Language Reference: https://www.mcmdl.com/docs/language-reference
|
56
|
+
• CLI Reference: https://www.mcmdl.com/docs/cli-reference
|
57
|
+
• Examples: https://www.mcmdl.com/docs/examples
|
58
|
+
|
59
|
+
🐛 Error Reporting:
|
60
|
+
==================
|
61
|
+
|
62
|
+
MDL provides detailed error messages with:
|
63
|
+
• Exact file location (line, column)
|
64
|
+
• Context lines showing the problematic code
|
65
|
+
• Helpful suggestions for fixing issues
|
66
|
+
• Multiple error collection and reporting
|
67
|
+
|
68
|
+
For support and bug reports, visit: https://github.com/aaron777collins/MinecraftDatapackLanguage
|
69
|
+
""")
|
93
70
|
|
94
71
|
|
95
72
|
def show_build_help():
|
96
73
|
"""Display detailed help for the build command."""
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
74
|
+
print("""
|
75
|
+
[BUILD] MDL Build Command - Compile MDL Files to Minecraft Datapacks
|
76
|
+
===============================================================
|
77
|
+
|
78
|
+
The build command compiles MDL files into standard Minecraft datapacks that can
|
79
|
+
be loaded directly into Minecraft.
|
80
|
+
|
81
|
+
[CMD] Usage:
|
82
|
+
========
|
83
|
+
|
84
|
+
mdl build --mdl <input> -o <output> [options]
|
85
|
+
|
86
|
+
[DIR] Arguments:
|
87
|
+
============
|
88
|
+
|
89
|
+
--mdl, -m <input> Input MDL file or directory containing .mdl files
|
90
|
+
Examples: --mdl project.mdl, --mdl src/, --mdl .
|
91
|
+
|
92
|
+
-o, --output <output> Output directory for the generated datapack
|
93
|
+
Example: -o dist, -o build/my_pack
|
94
|
+
|
95
|
+
[OPT] Options:
|
96
|
+
==========
|
97
|
+
|
98
|
+
--verbose, -v Enable verbose output with detailed build information
|
99
|
+
Shows file parsing, function generation, and progress
|
100
|
+
|
101
|
+
--pack-format <num> Override the pack format number in pack.mcmeta
|
102
|
+
Default: 82 (Minecraft 1.20+)
|
103
|
+
Example: --pack-format 15 (for older versions)
|
104
|
+
|
105
|
+
--wrapper <name> Create a zip file with the specified name
|
106
|
+
Example: --wrapper my_awesome_pack
|
107
|
+
|
108
|
+
--ignore-warnings Suppress warning messages during build
|
109
|
+
Only show errors, hide all warnings
|
110
|
+
|
111
|
+
[EX] Examples:
|
112
|
+
===========
|
113
|
+
|
114
|
+
1. Build a single MDL file:
|
115
|
+
mdl build --mdl hello_world.mdl -o dist
|
116
|
+
|
117
|
+
2. Build all MDL files in a directory:
|
118
|
+
mdl build --mdl src/ -o build/my_pack
|
119
|
+
|
120
|
+
3. Build current directory with verbose output:
|
121
|
+
mdl build --mdl . -o dist --verbose
|
122
|
+
|
123
|
+
4. Build with custom pack format and zip wrapper:
|
124
|
+
mdl build --mdl project.mdl -o dist --pack-format 15 --wrapper my_pack
|
125
|
+
|
126
|
+
5. Build multiple files in a directory:
|
127
|
+
mdl build --mdl examples/ -o output --verbose
|
128
|
+
|
129
|
+
[OUT] Output Structure:
|
130
|
+
===================
|
131
|
+
|
132
|
+
The build command creates a standard Minecraft datapack structure:
|
133
|
+
|
134
|
+
output/
|
135
|
+
├── pack.mcmeta # Datapack metadata
|
136
|
+
└── data/
|
137
|
+
├── <namespace>/ # Your datapack namespace
|
138
|
+
│ └── function/ # Generated functions
|
139
|
+
│ ├── load.mcfunction
|
140
|
+
│ └── *.mcfunction
|
141
|
+
└── minecraft/
|
142
|
+
└── tags/
|
143
|
+
└── function/ # Load/tick tags
|
144
|
+
├── load.json
|
145
|
+
└── tick.json
|
146
|
+
|
147
|
+
[FEAT] Features:
|
148
|
+
===========
|
149
|
+
|
150
|
+
• Multi-file compilation - Merge multiple .mdl files into one datapack
|
151
|
+
• Variable system - Automatic scoreboard objective creation
|
152
|
+
• Control structures - If/else statements and while loops
|
153
|
+
• Function calls - Call other functions within your datapack
|
154
|
+
• Raw commands - Use native Minecraft commands with $variable$ substitution
|
155
|
+
• Error handling - Detailed error reporting with suggestions
|
156
|
+
• Progress tracking - Verbose mode shows build progress
|
157
|
+
|
158
|
+
[CHECK] Error Handling:
|
159
|
+
=================
|
160
|
+
|
161
|
+
The build command provides comprehensive error reporting:
|
162
|
+
• Syntax errors with exact line and column numbers
|
163
|
+
• Context lines showing the problematic code
|
164
|
+
• Helpful suggestions for fixing issues
|
165
|
+
• Multiple error collection (won't stop on first error)
|
166
|
+
|
167
|
+
For more information, visit: https://www.mcmdl.com/docs/cli-reference#build
|
168
|
+
""")
|
172
169
|
|
173
170
|
|
174
171
|
def show_check_help():
|
175
172
|
"""Display detailed help for the check command."""
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
173
|
+
print("""
|
174
|
+
[CHECK] MDL Check Command - Validate MDL Files for Errors
|
175
|
+
====================================================
|
176
|
+
|
177
|
+
The check command validates MDL files for syntax errors, semantic issues, and
|
178
|
+
potential problems without generating any output files.
|
179
|
+
|
180
|
+
[CMD] Usage:
|
181
|
+
========
|
182
|
+
|
183
|
+
mdl check <input> [options]
|
184
|
+
|
185
|
+
[DIR] Arguments:
|
186
|
+
============
|
187
|
+
|
188
|
+
<input> Input MDL file or directory containing .mdl files
|
189
|
+
Examples: project.mdl, src/, .
|
190
|
+
|
191
|
+
[OPT] Options:
|
192
|
+
==========
|
193
|
+
|
194
|
+
--verbose, -v Enable verbose output with detailed validation information
|
195
|
+
Shows parsing steps, token analysis, and detailed error context
|
196
|
+
|
197
|
+
--ignore-warnings Suppress warning messages during check
|
198
|
+
Only show errors, hide all warnings
|
199
|
+
|
200
|
+
[EX] Examples:
|
201
|
+
===========
|
202
|
+
|
203
|
+
1. Check a single MDL file:
|
204
|
+
mdl check hello_world.mdl
|
205
|
+
|
206
|
+
2. Check all MDL files in a directory:
|
207
|
+
mdl check src/
|
208
|
+
|
209
|
+
3. Check current directory with verbose output:
|
210
|
+
mdl check . --verbose
|
211
|
+
|
212
|
+
4. Check multiple files:
|
213
|
+
mdl check examples/ --verbose
|
214
|
+
|
215
|
+
[CHECK] Validation Types:
|
216
|
+
===================
|
217
|
+
|
218
|
+
The check command performs comprehensive validation:
|
219
|
+
|
220
|
+
[EX] Syntax Validation:
|
221
|
+
• Lexical analysis - Token recognition and validation
|
222
|
+
• Parsing - AST construction and syntax structure
|
223
|
+
• Grammar validation - Language rule compliance
|
224
|
+
|
225
|
+
[OPT] Semantic Validation:
|
226
|
+
• Variable declarations - Proper variable naming and scope
|
227
|
+
• Function definitions - Valid function signatures
|
228
|
+
• Control structures - Proper if/else and while loop syntax
|
229
|
+
• Command validation - Minecraft command syntax checking
|
230
|
+
|
231
|
+
[WARN] Error Detection:
|
232
|
+
• Missing semicolons and braces
|
233
|
+
• Invalid variable names or references
|
234
|
+
• Unclosed strings and comments
|
235
|
+
• Malformed control structures
|
236
|
+
• Invalid selector syntax
|
237
|
+
• Undefined function calls
|
238
|
+
|
239
|
+
[REP] Error Reporting:
|
240
|
+
==================
|
241
|
+
|
242
|
+
The check command provides detailed error information:
|
243
|
+
|
244
|
+
[FEAT] Error Details:
|
245
|
+
• File path and exact location (line, column)
|
246
|
+
• Error type and description
|
247
|
+
• Context lines showing the problematic code
|
248
|
+
• Helpful suggestions for fixing issues
|
249
|
+
|
250
|
+
[CMD] Error Types:
|
251
|
+
• MDLSyntaxError - Basic syntax violations
|
252
|
+
• MDLLexerError - Token recognition issues
|
253
|
+
• MDLParserError - Parsing and structure problems
|
254
|
+
• MDLValidationError - Semantic validation failures
|
255
|
+
• MDLFileError - File access and I/O issues
|
256
|
+
|
257
|
+
[TIP] Example Error Output:
|
258
|
+
========================
|
259
|
+
|
260
|
+
Error 1: MDLSyntaxError in test.mdl:15:8
|
261
|
+
Missing closing brace for if statement
|
262
|
+
Context:
|
263
|
+
13: if (score > 10) {
|
264
|
+
14: say "High score!"
|
265
|
+
15: score = 0
|
266
|
+
16: }
|
267
|
+
|
268
|
+
Suggestion: Add closing brace '}' after line 15
|
269
|
+
|
270
|
+
[CHECK] Advanced Features:
|
271
|
+
====================
|
272
|
+
|
273
|
+
• Multi-file validation - Check entire projects at once
|
274
|
+
• Directory support - Recursively check all .mdl files
|
275
|
+
• Error collection - Report all errors, not just the first one
|
276
|
+
• Context preservation - Show surrounding code for better debugging
|
277
|
+
• Suggestion system - Provide helpful fix recommendations
|
278
|
+
|
279
|
+
[NEXT] Integration:
|
280
|
+
==============
|
281
|
+
|
282
|
+
The check command is perfect for:
|
283
|
+
• CI/CD pipelines - Automated validation
|
284
|
+
• Development workflows - Pre-commit checks
|
285
|
+
• Learning MDL - Understand syntax requirements
|
286
|
+
• Debugging - Identify and fix issues quickly
|
287
|
+
|
288
|
+
For more information, visit: https://www.mcmdl.com/docs/cli-reference#check
|
289
|
+
""")
|
249
290
|
|
250
291
|
|
251
292
|
def show_new_help():
|
252
293
|
"""Display detailed help for the new command."""
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
294
|
+
try:
|
295
|
+
from .cli_colors import color, print_header, print_title, print_section, print_separator, print_info, print_bullet, print_code
|
296
|
+
|
297
|
+
# Header
|
298
|
+
print()
|
299
|
+
print_header("MDL New Command - Create New MDL Projects")
|
300
|
+
print_separator("=", 65)
|
301
|
+
print()
|
302
|
+
|
303
|
+
# Description
|
304
|
+
print(color.info("The new command creates a new MDL project with template files and proper"))
|
305
|
+
print(color.info("structure to get you started quickly."))
|
306
|
+
print()
|
307
|
+
|
308
|
+
# Usage
|
309
|
+
print_section("Usage")
|
310
|
+
print()
|
311
|
+
print(f" {color.code('mdl new <project_name> [options]')}")
|
312
|
+
print()
|
313
|
+
|
314
|
+
# Arguments
|
315
|
+
print_section("Arguments")
|
316
|
+
print()
|
317
|
+
print(f" {color.highlight('<project_name>')} Name for your new MDL project")
|
318
|
+
print(f" This will be used for the project directory and pack name")
|
319
|
+
print(f" Example: {color.code('my_awesome_pack')}, {color.code('hello_world')}, {color.code('magic_system')}")
|
320
|
+
print()
|
321
|
+
|
322
|
+
# Options
|
323
|
+
print_section("Options")
|
324
|
+
print()
|
325
|
+
print(f" {color.command('--pack-name')} {color.highlight('<name>')} Custom name for the datapack (defaults to project name)")
|
326
|
+
print(f" This appears in the pack.mcmeta description")
|
327
|
+
print(f" Example: {color.code('--pack-name "My Awesome Magic Pack"')}")
|
328
|
+
print()
|
329
|
+
print(f" {color.command('--pack-format')} {color.highlight('<num>')} Pack format number for Minecraft version compatibility")
|
330
|
+
print(f" Default: {color.highlight('82')} (Minecraft 1.20+)")
|
331
|
+
print(f" Example: {color.code('--pack-format 15')} (for older versions)")
|
332
|
+
print()
|
333
|
+
|
334
|
+
# Examples
|
335
|
+
print_section("Examples")
|
336
|
+
print()
|
337
|
+
print(f"1. Create a basic project:")
|
338
|
+
print(f" {color.code('mdl new hello_world')}")
|
339
|
+
print()
|
340
|
+
print(f"2. Create project with custom pack name:")
|
341
|
+
print(f" {color.code('mdl new magic_system --pack-name "Epic Magic Pack"')}")
|
342
|
+
print()
|
343
|
+
print(f"3. Create project for older Minecraft version:")
|
344
|
+
print(f" {color.code('mdl new retro_pack --pack-format 15')}")
|
345
|
+
print()
|
346
|
+
print(f"4. Create project with all custom options:")
|
347
|
+
print(f" {color.code('mdl new my_project --pack-name "My Project" --pack-format 82')}")
|
348
|
+
print()
|
349
|
+
|
350
|
+
# Generated Structure
|
351
|
+
print_section("Generated Structure")
|
352
|
+
print()
|
353
|
+
print(color.info("The new command creates a complete project structure:"))
|
354
|
+
print()
|
355
|
+
print(f" {color.file_path('<project_name>/')}")
|
356
|
+
print(f" ├── {color.file_path('README.md')} # Project documentation")
|
357
|
+
print(f" └── {color.file_path('<project_name>.mdl')} # Main MDL file with template code")
|
358
|
+
print()
|
359
|
+
|
360
|
+
# Template Content
|
361
|
+
print_section("Template Content")
|
362
|
+
print()
|
363
|
+
print(color.info("The generated MDL file includes:"))
|
364
|
+
print()
|
365
|
+
|
366
|
+
print_section("Pack Declaration")
|
367
|
+
print(f"{color.code('pack {')}")
|
368
|
+
print(f"{color.code(' name: "project_name"')}")
|
369
|
+
print(f"{color.code(' format: 82')}")
|
370
|
+
print(f"{color.code(' description: "Generated by MDL CLI"')}")
|
371
|
+
print(f"{color.code('}')}")
|
372
|
+
print()
|
373
|
+
|
374
|
+
print_section("Example Functions")
|
375
|
+
print(f"{color.code('function main {')}")
|
376
|
+
print(f"{color.code(' say "Hello from MDL!"')}")
|
377
|
+
print(f"{color.code(' ')}")
|
378
|
+
print(f"{color.code(' // Variable example')}")
|
379
|
+
print(f"{color.code(' score = 10')}")
|
380
|
+
print(f"{color.code(' say "Score: $score$"')}")
|
381
|
+
print(f"{color.code(' ')}")
|
382
|
+
print(f"{color.code(' // Conditional example')}")
|
383
|
+
print(f"{color.code(' if (score > 5) {')}")
|
384
|
+
print(f"{color.code(' say "High score!"')}")
|
385
|
+
print(f"{color.code(' } else {')}")
|
386
|
+
print(f"{color.code(' say "Try again!"')}")
|
387
|
+
print(f"{color.code(' }')}")
|
388
|
+
print(f"{color.code('}')}")
|
389
|
+
print()
|
390
|
+
print(f"{color.code('function load {')}")
|
391
|
+
print(f"{color.code(' // This function runs when the datapack loads')}")
|
392
|
+
print(f"{color.code(' say "Datapack loaded successfully!"')}")
|
393
|
+
print(f"{color.code('}')}")
|
394
|
+
print()
|
395
|
+
|
396
|
+
# Features
|
397
|
+
print_section("Features")
|
398
|
+
print()
|
399
|
+
print_bullet("Complete project setup - Ready-to-use structure")
|
400
|
+
print_bullet("Template code - Working examples to learn from")
|
401
|
+
print_bullet("Proper pack metadata - Correct pack.mcmeta configuration")
|
402
|
+
print_bullet("Documentation - README with usage instructions")
|
403
|
+
print_bullet("Best practices - Follows MDL conventions")
|
404
|
+
print()
|
405
|
+
|
406
|
+
# Getting Started
|
407
|
+
print_section("Getting Started")
|
408
|
+
print()
|
409
|
+
print(color.info("After creating a new project:"))
|
410
|
+
print()
|
411
|
+
print(f"1. Navigate to the project directory:")
|
412
|
+
print(f" {color.code('cd <project_name>')}")
|
413
|
+
print()
|
414
|
+
print(f"2. Edit the MDL file:")
|
415
|
+
print(f" # Edit {color.file_path('<project_name>.mdl')} with your code")
|
416
|
+
print()
|
417
|
+
print(f"3. Build the datapack:")
|
418
|
+
print(f" {color.code('mdl build --mdl <project_name>.mdl -o dist')}")
|
419
|
+
print()
|
420
|
+
print(f"4. Check for errors:")
|
421
|
+
print(f" {color.code('mdl check <project_name>.mdl')}")
|
422
|
+
print()
|
423
|
+
print(f"5. Load in Minecraft:")
|
424
|
+
print(f" # Copy the dist folder to your world's datapacks directory")
|
425
|
+
print()
|
426
|
+
|
427
|
+
# Tips
|
428
|
+
print_section("Tips")
|
429
|
+
print()
|
430
|
+
print_bullet("Use descriptive project names - They become your namespace")
|
431
|
+
print_bullet("Start with the template code - It demonstrates key MDL features")
|
432
|
+
print_bullet("Check your code regularly - Use `mdl check` during development")
|
433
|
+
print_bullet("Use version control - Git is great for tracking changes")
|
434
|
+
print_bullet("Read the documentation - Learn about all available features")
|
435
|
+
print()
|
436
|
+
|
437
|
+
# Next Steps
|
438
|
+
print_section("Next Steps")
|
439
|
+
print()
|
440
|
+
print_bullet(f"Language Reference: {color.file_path('https://www.mcmdl.com/docs/language-reference')}")
|
441
|
+
print_bullet(f"Examples: {color.file_path('https://www.mcmdl.com/docs/examples')}")
|
442
|
+
print_bullet(f"CLI Reference: {color.file_path('https://www.mcmdl.com/docs/cli-reference')}")
|
443
|
+
print()
|
444
|
+
|
445
|
+
# More Info
|
446
|
+
print(color.info(f"For more information, visit: {color.file_path('https://www.mcmdl.com/docs/cli-reference#new')}"))
|
447
|
+
print()
|
448
|
+
|
449
|
+
except ImportError:
|
450
|
+
# Fallback if colors aren't available
|
451
|
+
print("""
|
452
|
+
[NEW] MDL New Command - Create New MDL Projects
|
453
|
+
============================================
|
326
454
|
|
455
|
+
The new command creates a new MDL project with template files and proper
|
456
|
+
structure to get you started quickly.
|
327
457
|
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
458
|
+
[CMD] Usage:
|
459
|
+
========
|
460
|
+
|
461
|
+
mdl new <project_name> [options]
|
462
|
+
|
463
|
+
[DIR] Arguments:
|
464
|
+
============
|
465
|
+
|
466
|
+
<project_name> Name for your new MDL project
|
467
|
+
This will be used for the project directory and pack name
|
468
|
+
Example: my_awesome_pack, hello_world, magic_system
|
469
|
+
|
470
|
+
[OPT] Options:
|
471
|
+
==========
|
472
|
+
|
473
|
+
--pack-name <name> Custom name for the datapack (defaults to project name)
|
474
|
+
This appears in the pack.mcmeta description
|
475
|
+
Example: --pack-name "My Awesome Magic Pack"
|
476
|
+
|
477
|
+
--pack-format <num> Pack format number for Minecraft version compatibility
|
478
|
+
Default: 82 (Minecraft 1.20+)
|
479
|
+
Example: --pack-format 15 (for older versions)
|
480
|
+
|
481
|
+
[EX] Examples:
|
482
|
+
===========
|
483
|
+
|
484
|
+
1. Create a basic project:
|
485
|
+
mdl new hello_world
|
486
|
+
|
487
|
+
2. Create project with custom pack name:
|
488
|
+
mdl new magic_system --pack-name "Epic Magic Pack"
|
489
|
+
|
490
|
+
3. Create project for older Minecraft version:
|
491
|
+
mdl new retro_pack --pack-format 15
|
492
|
+
|
493
|
+
4. Create project with all custom options:
|
494
|
+
mdl new my_project --pack-name "My Project" --pack-format 82
|
495
|
+
|
496
|
+
[OUT] Generated Structure:
|
497
|
+
======================
|
498
|
+
|
499
|
+
The new command creates a complete project structure:
|
500
|
+
|
501
|
+
<project_name>/
|
502
|
+
├── README.md # Project documentation
|
503
|
+
└── <project_name>.mdl # Main MDL file with template code
|
504
|
+
|
505
|
+
[FILE] Template Content:
|
506
|
+
===================
|
507
|
+
|
508
|
+
The generated MDL file includes:
|
509
|
+
|
510
|
+
[CMD] Pack Declaration:
|
511
|
+
```mdl
|
512
|
+
pack {
|
513
|
+
name: "project_name"
|
514
|
+
format: 82
|
515
|
+
description: "Generated by MDL CLI"
|
516
|
+
}
|
517
|
+
```
|
518
|
+
|
519
|
+
[OPT] Example Functions:
|
520
|
+
```mdl
|
521
|
+
function main {
|
522
|
+
say "Hello from MDL!"
|
523
|
+
|
524
|
+
// Variable example
|
525
|
+
score = 10
|
526
|
+
say "Score: $score$"
|
527
|
+
|
528
|
+
// Conditional example
|
529
|
+
if (score > 5) {
|
530
|
+
say "High score!"
|
531
|
+
} else {
|
532
|
+
say "Try again!"
|
533
|
+
}
|
534
|
+
}
|
535
|
+
|
536
|
+
function load {
|
537
|
+
// This function runs when the datapack loads
|
538
|
+
say "Datapack loaded successfully!"
|
539
|
+
}
|
540
|
+
```
|
541
|
+
|
542
|
+
[FEAT] Features:
|
543
|
+
===========
|
544
|
+
|
545
|
+
• Complete project setup - Ready-to-use structure
|
546
|
+
• Template code - Working examples to learn from
|
547
|
+
• Proper pack metadata - Correct pack.mcmeta configuration
|
548
|
+
• Documentation - README with usage instructions
|
549
|
+
• Best practices - Follows MDL conventions
|
550
|
+
|
551
|
+
[NEXT] Getting Started:
|
552
|
+
==================
|
553
|
+
|
554
|
+
After creating a new project:
|
555
|
+
|
556
|
+
1. Navigate to the project directory:
|
557
|
+
cd <project_name>
|
558
|
+
|
559
|
+
2. Edit the MDL file:
|
560
|
+
# Edit <project_name>.mdl with your code
|
561
|
+
|
562
|
+
3. Build the datapack:
|
563
|
+
mdl build --mdl <project_name>.mdl -o dist
|
564
|
+
|
565
|
+
4. Check for errors:
|
566
|
+
mdl check <project_name>.mdl
|
567
|
+
|
568
|
+
5. Load in Minecraft:
|
569
|
+
# Copy the dist folder to your world's datapacks directory
|
570
|
+
|
571
|
+
[TIP] Tips:
|
572
|
+
========
|
573
|
+
|
574
|
+
• Use descriptive project names - They become your namespace
|
575
|
+
• Start with the template code - It demonstrates key MDL features
|
576
|
+
• Check your code regularly - Use `mdl check` during development
|
577
|
+
• Use version control - Git is great for tracking changes
|
578
|
+
• Read the documentation - Learn about all available features
|
579
|
+
|
580
|
+
[INFO] Next Steps:
|
581
|
+
=============
|
582
|
+
|
583
|
+
• Language Reference: https://www.mcmdl.com/docs/language-reference
|
584
|
+
• Examples: https://www.mcmdl.com/docs/examples
|
585
|
+
• CLI Reference: https://www.mcmdl.com/docs/cli-reference
|
586
|
+
|
587
|
+
For more information, visit: https://www.mcmdl.com/docs/cli-reference#new
|
588
|
+
""")
|