minecraft-datapack-language 15.3.7__py3-none-any.whl → 15.3.8__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 +40 -17
- {minecraft_datapack_language-15.3.7.dist-info → minecraft_datapack_language-15.3.8.dist-info}/METADATA +1 -1
- {minecraft_datapack_language-15.3.7.dist-info → minecraft_datapack_language-15.3.8.dist-info}/RECORD +8 -8
- {minecraft_datapack_language-15.3.7.dist-info → minecraft_datapack_language-15.3.8.dist-info}/WHEEL +0 -0
- {minecraft_datapack_language-15.3.7.dist-info → minecraft_datapack_language-15.3.8.dist-info}/entry_points.txt +0 -0
- {minecraft_datapack_language-15.3.7.dist-info → minecraft_datapack_language-15.3.8.dist-info}/licenses/LICENSE +0 -0
- {minecraft_datapack_language-15.3.7.dist-info → minecraft_datapack_language-15.3.8.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.3.
|
32
|
-
__version_tuple__ = version_tuple = (15, 3,
|
31
|
+
__version__ = version = '15.3.8'
|
32
|
+
__version_tuple__ = version_tuple = (15, 3, 8)
|
33
33
|
|
34
34
|
__commit_id__ = commit_id = None
|
@@ -319,13 +319,23 @@ def _process_statement(statement: Any, namespace: str, function_name: str, state
|
|
319
319
|
var_name = statement['name']
|
320
320
|
value = statement['value']
|
321
321
|
|
322
|
+
# Determine the correct selector for this variable based on its declared scope
|
323
|
+
var_selector = selector # Default to current selector
|
324
|
+
if variable_scopes and var_name in variable_scopes:
|
325
|
+
declared_scope = variable_scopes[var_name]
|
326
|
+
if declared_scope == 'global':
|
327
|
+
var_selector = "@e[type=armor_stand,tag=mdl_server,limit=1]"
|
328
|
+
else:
|
329
|
+
var_selector = declared_scope
|
330
|
+
print(f"DEBUG: Variable {var_name} assignment using selector: {var_selector} (declared scope: {variable_scopes.get(var_name, 'none')})")
|
331
|
+
|
322
332
|
# Handle different value types
|
323
333
|
if isinstance(value, int):
|
324
|
-
commands.append(f"scoreboard players set {
|
334
|
+
commands.append(f"scoreboard players set {var_selector} {var_name} {value}")
|
325
335
|
elif isinstance(value, str) and value.startswith('$') and value.endswith('$'):
|
326
336
|
# Variable reference
|
327
337
|
ref_var = value[1:-1] # Remove $ symbols
|
328
|
-
commands.append(f"scoreboard players operation {
|
338
|
+
commands.append(f"scoreboard players operation {var_selector} {var_name} = {var_selector} {ref_var}")
|
329
339
|
elif hasattr(value, '__class__') and 'BinaryExpression' in str(value.__class__):
|
330
340
|
# Handle complex expressions (BinaryExpression, etc.)
|
331
341
|
# Convert to proper Minecraft scoreboard commands
|
@@ -338,17 +348,17 @@ def _process_statement(statement: Any, namespace: str, function_name: str, state
|
|
338
348
|
if operator == 'PLUS':
|
339
349
|
if hasattr(left, 'name') and hasattr(right, 'value'):
|
340
350
|
# counter = counter + 1
|
341
|
-
commands.append(f"scoreboard players add {
|
351
|
+
commands.append(f"scoreboard players add {var_selector} {var_name} {right.value}")
|
342
352
|
else:
|
343
353
|
# Complex case - use operation
|
344
354
|
commands.append(f"# Complex addition: {var_name} = {left} + {right}")
|
345
355
|
elif operator == 'MINUS':
|
346
356
|
if hasattr(left, 'name') and hasattr(right, 'value'):
|
347
357
|
# health = health - 10
|
348
|
-
commands.append(f"scoreboard players remove {
|
358
|
+
commands.append(f"scoreboard players remove {var_selector} {var_name} {right.value}")
|
349
359
|
else:
|
350
360
|
# Complex case - use operation
|
351
|
-
commands.append(f"# Complex
|
361
|
+
commands.append(f"# Complex operation: {var_name} = {left} - {right}")
|
352
362
|
else:
|
353
363
|
# Other operators - use operation
|
354
364
|
commands.append(f"# Complex operation: {var_name} = {left} {operator} {right}")
|
@@ -360,11 +370,11 @@ def _process_statement(statement: Any, namespace: str, function_name: str, state
|
|
360
370
|
if hasattr(value, 'value'):
|
361
371
|
# LiteralExpression case
|
362
372
|
num_value = int(value.value)
|
363
|
-
commands.append(f"scoreboard players set {
|
373
|
+
commands.append(f"scoreboard players set {var_selector} {var_name} {num_value}")
|
364
374
|
else:
|
365
375
|
# Direct value case
|
366
376
|
num_value = int(value)
|
367
|
-
commands.append(f"scoreboard players set {
|
377
|
+
commands.append(f"scoreboard players set {var_selector} {var_name} {num_value}")
|
368
378
|
except (ValueError, TypeError):
|
369
379
|
# If we can't convert to int, add a placeholder
|
370
380
|
commands.append(f"# Assignment: {var_name} = {value}")
|
@@ -795,16 +805,29 @@ def _ast_to_pack(ast: Dict[str, Any], mdl_files: List[Path]) -> Pack:
|
|
795
805
|
else:
|
796
806
|
# Simple function call without scope
|
797
807
|
function.commands.append(f"function {func_namespace}:{func_name}")
|
798
|
-
|
799
|
-
|
800
|
-
|
801
|
-
|
802
|
-
|
803
|
-
|
804
|
-
|
805
|
-
|
806
|
-
|
807
|
-
|
808
|
+
elif statement.get('type') == 'variable_assignment':
|
809
|
+
# Handle variable assignments
|
810
|
+
var_name = statement['name']
|
811
|
+
value = statement['value']
|
812
|
+
|
813
|
+
# Determine selector based on variable scope
|
814
|
+
var_selector = "@s" # Default
|
815
|
+
if 'variables' in ast:
|
816
|
+
for var_decl in ast['variables']:
|
817
|
+
if var_decl.get('name') == var_name:
|
818
|
+
var_scope = var_decl.get('scope')
|
819
|
+
if var_scope == 'global':
|
820
|
+
var_selector = "@e[type=armor_stand,tag=mdl_server,limit=1]"
|
821
|
+
elif var_scope:
|
822
|
+
var_selector = var_scope
|
823
|
+
break
|
824
|
+
|
825
|
+
if hasattr(value, 'value'):
|
826
|
+
# Simple literal value
|
827
|
+
function.commands.append(f"scoreboard players set {var_name} {var_selector} {value.value}")
|
828
|
+
else:
|
829
|
+
# Complex expression - add a placeholder
|
830
|
+
function.commands.append(f"# Variable assignment: {var_name} = {value}")
|
808
831
|
else:
|
809
832
|
# Add a placeholder for other statement types
|
810
833
|
function.commands.append(f"# Statement: {statement.get('type', 'unknown')}")
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: minecraft-datapack-language
|
3
|
-
Version: 15.3.
|
3
|
+
Version: 15.3.8
|
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
|
{minecraft_datapack_language-15.3.7.dist-info → minecraft_datapack_language-15.3.8.dist-info}/RECORD
RENAMED
@@ -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=5Brn3tTXfQ-8VOitx7xWNfzbtGKr8Ew9f_ekMlcHt4Q,706
|
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=T3xVSRDigJpyph4Nam_Sf9dXXHE7Qu3QwvfCmCGXno4,46032
|
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=Ap7EDpC5wbu1qFmC8htzd8rRqSyYugt58h0AppfDD6s,40171
|
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.3.
|
20
|
-
minecraft_datapack_language-15.3.
|
21
|
-
minecraft_datapack_language-15.3.
|
22
|
-
minecraft_datapack_language-15.3.
|
23
|
-
minecraft_datapack_language-15.3.
|
24
|
-
minecraft_datapack_language-15.3.
|
19
|
+
minecraft_datapack_language-15.3.8.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
20
|
+
minecraft_datapack_language-15.3.8.dist-info/METADATA,sha256=lCeuK6MGu76vUYdj3vX1jOBrvLGelya7GhhFoC5_BNQ,35229
|
21
|
+
minecraft_datapack_language-15.3.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
22
|
+
minecraft_datapack_language-15.3.8.dist-info/entry_points.txt,sha256=c6vjBeCiyQflvPHBRyBk2nJCSfYt3Oc7Sc9V87ySi_U,108
|
23
|
+
minecraft_datapack_language-15.3.8.dist-info/top_level.txt,sha256=ADtFI476tbKLLxEAA-aJQAfg53MA3k_DOb0KTFiggfw,28
|
24
|
+
minecraft_datapack_language-15.3.8.dist-info/RECORD,,
|
{minecraft_datapack_language-15.3.7.dist-info → minecraft_datapack_language-15.3.8.dist-info}/WHEEL
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|