minecraft-datapack-language 15.1.61__py3-none-any.whl → 15.1.63__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 +55 -5
- {minecraft_datapack_language-15.1.61.dist-info → minecraft_datapack_language-15.1.63.dist-info}/METADATA +1 -1
- {minecraft_datapack_language-15.1.61.dist-info → minecraft_datapack_language-15.1.63.dist-info}/RECORD +8 -8
- {minecraft_datapack_language-15.1.61.dist-info → minecraft_datapack_language-15.1.63.dist-info}/WHEEL +0 -0
- {minecraft_datapack_language-15.1.61.dist-info → minecraft_datapack_language-15.1.63.dist-info}/entry_points.txt +0 -0
- {minecraft_datapack_language-15.1.61.dist-info → minecraft_datapack_language-15.1.63.dist-info}/licenses/LICENSE +0 -0
- {minecraft_datapack_language-15.1.61.dist-info → minecraft_datapack_language-15.1.63.dist-info}/top_level.txt +0 -0
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
|
|
28
28
|
commit_id: COMMIT_ID
|
29
29
|
__commit_id__: COMMIT_ID
|
30
30
|
|
31
|
-
__version__ = version = '15.1.
|
32
|
-
__version_tuple__ = version_tuple = (15, 1,
|
31
|
+
__version__ = version = '15.1.63'
|
32
|
+
__version_tuple__ = version_tuple = (15, 1, 63)
|
33
33
|
|
34
34
|
__commit_id__ = commit_id = None
|
@@ -209,6 +209,51 @@ def _generate_load_function(scoreboard_commands: List[str], output_dir: Path, na
|
|
209
209
|
f.write('\n'.join(load_content))
|
210
210
|
|
211
211
|
|
212
|
+
def _process_say_command_with_variables(content: str, selector: str) -> str:
|
213
|
+
"""Process say command content with variable substitution, converting to tellraw with score components."""
|
214
|
+
import re
|
215
|
+
|
216
|
+
# Find all variable references like $variable$ or $variable<selector>$
|
217
|
+
var_pattern = r'\$([^$]+)\$'
|
218
|
+
matches = re.findall(var_pattern, content)
|
219
|
+
|
220
|
+
if not matches:
|
221
|
+
# No variables, return simple tellraw
|
222
|
+
return f'tellraw @a [{{"text":{content}}}]'
|
223
|
+
|
224
|
+
# Split content by variable references
|
225
|
+
parts = re.split(var_pattern, content)
|
226
|
+
|
227
|
+
# Build tellraw components
|
228
|
+
components = []
|
229
|
+
var_index = 0
|
230
|
+
|
231
|
+
for i, part in enumerate(parts):
|
232
|
+
if part: # Add text component if not empty
|
233
|
+
components.append(f'{{"text":"{part}"}}')
|
234
|
+
|
235
|
+
# Add score component if this is followed by a variable
|
236
|
+
if i < len(parts) - 1 and var_index < len(matches):
|
237
|
+
var_name = matches[var_index]
|
238
|
+
|
239
|
+
# Check if variable has scope selector
|
240
|
+
if '<' in var_name and var_name.endswith('>'):
|
241
|
+
# Scoped variable: $variable<selector>$
|
242
|
+
var_parts = var_name.split('<', 1)
|
243
|
+
base_var = var_parts[0]
|
244
|
+
var_selector = var_parts[1][:-1] # Remove trailing >
|
245
|
+
components.append(f'{{"score":{{"name":"{var_selector}","objective":"{base_var}"}}}}')
|
246
|
+
else:
|
247
|
+
# Simple variable: $variable$
|
248
|
+
components.append(f'{{"score":{{"name":"{selector}","objective":"{var_name}"}}}}')
|
249
|
+
|
250
|
+
var_index += 1
|
251
|
+
|
252
|
+
# Combine all components
|
253
|
+
components_str = ','.join(components)
|
254
|
+
return f'tellraw @a [{components_str}]'
|
255
|
+
|
256
|
+
|
212
257
|
def _process_statement(statement: Any, namespace: str, function_name: str, statement_index: int = 0, is_tag_function: bool = False, selector: str = "@s", variable_scopes: Dict[str, str] = None, build_context: BuildContext = None) -> List[str]:
|
213
258
|
"""Process a single statement and return Minecraft commands."""
|
214
259
|
if variable_scopes is None:
|
@@ -227,8 +272,7 @@ def _process_statement(statement: Any, namespace: str, function_name: str, state
|
|
227
272
|
# Convert say command to tellraw command
|
228
273
|
content = command[4:] # Remove "say " prefix
|
229
274
|
# Convert to Minecraft tellraw format
|
230
|
-
|
231
|
-
processed_command = _process_variable_substitutions(tellraw_command, selector)
|
275
|
+
processed_command = _process_say_command_with_variables(content, selector)
|
232
276
|
commands.append(processed_command)
|
233
277
|
else:
|
234
278
|
# Process other commands normally
|
@@ -251,10 +295,16 @@ def _process_statement(statement: Any, namespace: str, function_name: str, state
|
|
251
295
|
# For now, add a placeholder command
|
252
296
|
commands.append(f"# Complex assignment: {var_name} = {value}")
|
253
297
|
else:
|
254
|
-
#
|
298
|
+
# Handle LiteralExpression and other value types
|
255
299
|
try:
|
256
|
-
|
257
|
-
|
300
|
+
if hasattr(value, 'value'):
|
301
|
+
# LiteralExpression case
|
302
|
+
num_value = int(value.value)
|
303
|
+
commands.append(f"scoreboard players set {var_name} {selector} {num_value}")
|
304
|
+
else:
|
305
|
+
# Direct value case
|
306
|
+
num_value = int(value)
|
307
|
+
commands.append(f"scoreboard players set {var_name} {selector} {num_value}")
|
258
308
|
except (ValueError, TypeError):
|
259
309
|
# If we can't convert to int, add a placeholder
|
260
310
|
commands.append(f"# Assignment: {var_name} = {value}")
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: minecraft-datapack-language
|
3
|
-
Version: 15.1.
|
3
|
+
Version: 15.1.63
|
4
4
|
Summary: Compile JavaScript-style MDL language or Python API into a Minecraft datapack (1.21+ ready). Features variables, control flow, error handling, and VS Code extension.
|
5
5
|
Project-URL: Homepage, https://www.mcmdl.com
|
6
6
|
Project-URL: Documentation, https://www.mcmdl.com/docs
|
@@ -1,8 +1,8 @@
|
|
1
1
|
minecraft_datapack_language/__init__.py,sha256=i-qCchbe5b2Fshgc6yCU9mddOLs2UBt9SAcLqfUIrT0,606
|
2
|
-
minecraft_datapack_language/_version.py,sha256=
|
2
|
+
minecraft_datapack_language/_version.py,sha256=kT4vFfqTGE0yqzzOA5QjfjVNdwoR0e2Fdpe1CF8Ke6E,708
|
3
3
|
minecraft_datapack_language/ast_nodes.py,sha256=pgjI2Nlap3ixFPgWqGSkqncG9zB91h5BKgRjtcJqMew,2118
|
4
4
|
minecraft_datapack_language/cli.py,sha256=p5A_tEEXugN2NhQFbbgfwi4FxbWYD91RWeKR_A3Vuec,6263
|
5
|
-
minecraft_datapack_language/cli_build.py,sha256=
|
5
|
+
minecraft_datapack_language/cli_build.py,sha256=_U8pYPpjcaaODb6wfyUUzdA1ki8MmF_6_MBdBxmrafY,36574
|
6
6
|
minecraft_datapack_language/cli_check.py,sha256=bPq9gHsxQ1CIiftkrAtRCifWkVAyjp5c8Oay2NNQ1qs,6277
|
7
7
|
minecraft_datapack_language/cli_help.py,sha256=jUTHUQBONAZKVTdQK9tNPXq4c_6xpsafNOvHDjkEldg,12243
|
8
8
|
minecraft_datapack_language/cli_new.py,sha256=uaKH0VBC43XBt_Hztc35-BfC9bYlsDdLbAfe_42rrtI,8235
|
@@ -16,9 +16,9 @@ minecraft_datapack_language/mdl_linter.py,sha256=z85xoAglENurCh30bR7kEHZ_JeMxcYa
|
|
16
16
|
minecraft_datapack_language/mdl_parser_js.py,sha256=4VMWx6O7A10afTzjGnnwL_Sh52osIO84ObqHp8KoDZw,38677
|
17
17
|
minecraft_datapack_language/pack.py,sha256=nYiXQ3jgJlDfc4m-65f7C2LFhDRioaUU_XVy6Na4SJI,34625
|
18
18
|
minecraft_datapack_language/utils.py,sha256=Aq0HAGlXqj9BUTEjaEilpvzEW0EtZYYMMwOqG9db6dE,684
|
19
|
-
minecraft_datapack_language-15.1.
|
20
|
-
minecraft_datapack_language-15.1.
|
21
|
-
minecraft_datapack_language-15.1.
|
22
|
-
minecraft_datapack_language-15.1.
|
23
|
-
minecraft_datapack_language-15.1.
|
24
|
-
minecraft_datapack_language-15.1.
|
19
|
+
minecraft_datapack_language-15.1.63.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
20
|
+
minecraft_datapack_language-15.1.63.dist-info/METADATA,sha256=4V1-aPYtWcii4iq4tvsnPHLSIfzdJzku230oYucm_aY,35230
|
21
|
+
minecraft_datapack_language-15.1.63.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
22
|
+
minecraft_datapack_language-15.1.63.dist-info/entry_points.txt,sha256=c6vjBeCiyQflvPHBRyBk2nJCSfYt3Oc7Sc9V87ySi_U,108
|
23
|
+
minecraft_datapack_language-15.1.63.dist-info/top_level.txt,sha256=ADtFI476tbKLLxEAA-aJQAfg53MA3k_DOb0KTFiggfw,28
|
24
|
+
minecraft_datapack_language-15.1.63.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|