minecraft-datapack-language 16.0.0__py3-none-any.whl → 16.0.2__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/mdl_compiler.py +57 -13
- {minecraft_datapack_language-16.0.0.dist-info → minecraft_datapack_language-16.0.2.dist-info}/METADATA +1 -1
- {minecraft_datapack_language-16.0.0.dist-info → minecraft_datapack_language-16.0.2.dist-info}/RECORD +8 -8
- {minecraft_datapack_language-16.0.0.dist-info → minecraft_datapack_language-16.0.2.dist-info}/WHEEL +0 -0
- {minecraft_datapack_language-16.0.0.dist-info → minecraft_datapack_language-16.0.2.dist-info}/entry_points.txt +0 -0
- {minecraft_datapack_language-16.0.0.dist-info → minecraft_datapack_language-16.0.2.dist-info}/licenses/LICENSE +0 -0
- {minecraft_datapack_language-16.0.0.dist-info → minecraft_datapack_language-16.0.2.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 = '16.0.
|
32
|
-
__version_tuple__ = version_tuple = (16, 0,
|
31
|
+
__version__ = version = '16.0.2'
|
32
|
+
__version_tuple__ = version_tuple = (16, 0, 2)
|
33
33
|
|
34
34
|
__commit_id__ = commit_id = None
|
@@ -270,10 +270,15 @@ class MDLCompiler:
|
|
270
270
|
tags_fn_dir = self.output_dir / "data" / "minecraft" / self.dir_map.tags_function
|
271
271
|
tags_fn_dir.mkdir(parents=True, exist_ok=True)
|
272
272
|
load_tag_file = tags_fn_dir / "load.json"
|
273
|
-
#
|
273
|
+
# Always include namespace:load (contains scoreboard initialization), plus any explicit on_load hooks
|
274
274
|
values = [f"{self.current_namespace}:load"]
|
275
275
|
if has_on_load:
|
276
|
-
|
276
|
+
# Add explicit on_load hooks as additional entries
|
277
|
+
for hook in hooks:
|
278
|
+
if hook.hook_type == "on_load":
|
279
|
+
hook_ref = f"{hook.namespace}:{hook.name}"
|
280
|
+
if hook_ref not in values: # Avoid duplicates
|
281
|
+
values.append(hook_ref)
|
277
282
|
with open(load_tag_file, 'w') as f:
|
278
283
|
json.dump({"values": values}, f, indent=2)
|
279
284
|
|
@@ -369,8 +374,16 @@ class MDLCompiler:
|
|
369
374
|
# Return the command to set the target variable from the temp
|
370
375
|
return f"scoreboard players operation {scope} {objective} = @s {temp_var}"
|
371
376
|
else:
|
372
|
-
# Simple value - use direct assignment
|
377
|
+
# Simple value - use direct assignment or scoreboard copy
|
373
378
|
value = self._expression_to_value(assignment.value)
|
379
|
+
# If RHS resolves to a scoreboard reference (e.g., 'score @s some_obj'),
|
380
|
+
# emit an operation copy instead of an invalid 'set ... score ...'
|
381
|
+
if isinstance(value, str) and value.startswith("score "):
|
382
|
+
parts = value.split()
|
383
|
+
if len(parts) >= 3:
|
384
|
+
src_scope = parts[1]
|
385
|
+
src_objective = parts[2]
|
386
|
+
return f"scoreboard players operation {scope} {objective} = {src_scope} {src_objective}"
|
374
387
|
return f"scoreboard players set {scope} {objective} {value}"
|
375
388
|
|
376
389
|
def _variable_declaration_to_command(self, decl: VariableDeclaration) -> str:
|
@@ -388,6 +401,13 @@ class MDLCompiler:
|
|
388
401
|
except Exception:
|
389
402
|
init = None
|
390
403
|
if init is not None:
|
404
|
+
# Initialize from another scoreboard using operation copy
|
405
|
+
if isinstance(init, str) and init.startswith("score "):
|
406
|
+
parts = init.split()
|
407
|
+
if len(parts) >= 3:
|
408
|
+
src_scope = parts[1]
|
409
|
+
src_objective = parts[2]
|
410
|
+
return f"scoreboard players operation {scope} {objective} = {src_scope} {src_objective}"
|
391
411
|
return f"scoreboard players set {scope} {objective} {init}"
|
392
412
|
return f"# var {decl.name} declared"
|
393
413
|
|
@@ -772,7 +792,7 @@ class MDLCompiler:
|
|
772
792
|
self._store_temp_command(f"scoreboard players operation @s {temp_var} = @s {left_temp}")
|
773
793
|
else:
|
774
794
|
# Assign from left value (score or literal)
|
775
|
-
if isinstance(expression.left, VariableSubstitution) or (isinstance(
|
795
|
+
if isinstance(expression.left, VariableSubstitution) or (isinstance(left_value, str) and left_value.startswith("score ")):
|
776
796
|
parts = str(left_value).split()
|
777
797
|
scope = parts[1]
|
778
798
|
obj = parts[2]
|
@@ -780,7 +800,7 @@ class MDLCompiler:
|
|
780
800
|
else:
|
781
801
|
self._store_temp_command(f"scoreboard players set @s {temp_var} {left_value}")
|
782
802
|
# Add right value
|
783
|
-
if isinstance(expression.right, VariableSubstitution) or (isinstance(
|
803
|
+
if isinstance(expression.right, VariableSubstitution) or (isinstance(right_value, str) and right_value.startswith("score ")):
|
784
804
|
parts = str(right_value).split()
|
785
805
|
scope = parts[1]
|
786
806
|
obj = parts[2]
|
@@ -792,7 +812,7 @@ class MDLCompiler:
|
|
792
812
|
if isinstance(expression.left, BinaryExpression):
|
793
813
|
self._store_temp_command(f"scoreboard players operation @s {temp_var} = @s {left_temp}")
|
794
814
|
else:
|
795
|
-
if isinstance(expression.left, VariableSubstitution) or (isinstance(
|
815
|
+
if isinstance(expression.left, VariableSubstitution) or (isinstance(left_value, str) and left_value.startswith("score ")):
|
796
816
|
parts = str(left_value).split()
|
797
817
|
scope = parts[1]
|
798
818
|
obj = parts[2]
|
@@ -800,7 +820,7 @@ class MDLCompiler:
|
|
800
820
|
else:
|
801
821
|
self._store_temp_command(f"scoreboard players set @s {temp_var} {left_value}")
|
802
822
|
# Subtract right value
|
803
|
-
if isinstance(expression.right, VariableSubstitution) or (isinstance(
|
823
|
+
if isinstance(expression.right, VariableSubstitution) or (isinstance(right_value, str) and right_value.startswith("score ")):
|
804
824
|
parts = str(right_value).split()
|
805
825
|
scope = parts[1]
|
806
826
|
obj = parts[2]
|
@@ -812,7 +832,7 @@ class MDLCompiler:
|
|
812
832
|
if isinstance(expression.left, BinaryExpression):
|
813
833
|
self._store_temp_command(f"scoreboard players operation @s {temp_var} = @s {left_temp}")
|
814
834
|
else:
|
815
|
-
if isinstance(expression.left, VariableSubstitution) or (isinstance(
|
835
|
+
if isinstance(expression.left, VariableSubstitution) or (isinstance(left_value, str) and left_value.startswith("score ")):
|
816
836
|
parts = str(left_value).split()
|
817
837
|
scope = parts[1]
|
818
838
|
obj = parts[2]
|
@@ -825,15 +845,27 @@ class MDLCompiler:
|
|
825
845
|
else:
|
826
846
|
# For literal values, keep explicit multiply command for compatibility
|
827
847
|
if isinstance(expression.right, LiteralExpression):
|
828
|
-
|
848
|
+
# Normalize number formatting (e.g., 2.0 -> 2)
|
849
|
+
literal_str = self._expression_to_value(expression.right)
|
850
|
+
self._store_temp_command(f"scoreboard players multiply @s {temp_var} {literal_str}")
|
829
851
|
else:
|
830
|
-
|
852
|
+
# If right_value is a score reference string, strip the leading 'score '
|
853
|
+
if isinstance(right_value, str) and right_value.startswith("score "):
|
854
|
+
parts = right_value.split()
|
855
|
+
if len(parts) >= 3:
|
856
|
+
scope = parts[1]
|
857
|
+
obj = parts[2]
|
858
|
+
self._store_temp_command(f"scoreboard players operation @s {temp_var} *= {scope} {obj}")
|
859
|
+
else:
|
860
|
+
self._store_temp_command(f"scoreboard players operation @s {temp_var} *= {right_value}")
|
861
|
+
else:
|
862
|
+
self._store_temp_command(f"scoreboard players operation @s {temp_var} *= {right_value}")
|
831
863
|
|
832
864
|
elif expression.operator == "DIVIDE":
|
833
865
|
if isinstance(expression.left, BinaryExpression):
|
834
866
|
self._store_temp_command(f"scoreboard players operation @s {temp_var} = @s {left_temp}")
|
835
867
|
else:
|
836
|
-
if isinstance(expression.left, VariableSubstitution) or (isinstance(
|
868
|
+
if isinstance(expression.left, VariableSubstitution) or (isinstance(left_value, str) and left_value.startswith("score ")):
|
837
869
|
parts = str(left_value).split()
|
838
870
|
scope = parts[1]
|
839
871
|
obj = parts[2]
|
@@ -846,9 +878,21 @@ class MDLCompiler:
|
|
846
878
|
else:
|
847
879
|
# For literal values, keep explicit divide command for compatibility
|
848
880
|
if isinstance(expression.right, LiteralExpression):
|
849
|
-
|
881
|
+
# Normalize number formatting (e.g., 2.0 -> 2)
|
882
|
+
literal_str = self._expression_to_value(expression.right)
|
883
|
+
self._store_temp_command(f"scoreboard players divide @s {temp_var} {literal_str}")
|
850
884
|
else:
|
851
|
-
|
885
|
+
# If right_value is a score reference string, strip the leading 'score '
|
886
|
+
if isinstance(right_value, str) and right_value.startswith("score "):
|
887
|
+
parts = right_value.split()
|
888
|
+
if len(parts) >= 3:
|
889
|
+
scope = parts[1]
|
890
|
+
obj = parts[2]
|
891
|
+
self._store_temp_command(f"scoreboard players operation @s {temp_var} /= {scope} {obj}")
|
892
|
+
else:
|
893
|
+
self._store_temp_command(f"scoreboard players operation @s {temp_var} /= {right_value}")
|
894
|
+
else:
|
895
|
+
self._store_temp_command(f"scoreboard players operation @s {temp_var} /= {right_value}")
|
852
896
|
else:
|
853
897
|
# For other operators, just set the value
|
854
898
|
self._store_temp_command(f"scoreboard players set @s {temp_var} 0")
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: minecraft-datapack-language
|
3
|
-
Version: 16.0.
|
3
|
+
Version: 16.0.2
|
4
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
5
|
Project-URL: Homepage, https://www.mcmdl.com
|
6
6
|
Project-URL: Documentation, https://www.mcmdl.com/docs
|
{minecraft_datapack_language-16.0.0.dist-info → minecraft_datapack_language-16.0.2.dist-info}/RECORD
RENAMED
@@ -1,18 +1,18 @@
|
|
1
1
|
minecraft_datapack_language/__init__.py,sha256=0KVXBE4ScRaRUrf83aA2tVB-y8A_jplyaxVvtHH6Uw0,1199
|
2
|
-
minecraft_datapack_language/_version.py,sha256=
|
2
|
+
minecraft_datapack_language/_version.py,sha256=gTTJVB75BNER1i08XUYQNvwb6V_T8h-gkDQrn1Jaars,706
|
3
3
|
minecraft_datapack_language/ast_nodes.py,sha256=UzUxKLkjBisUd5Gu7sAiNXIIPIjNoRzELq4LfIFcnSY,4290
|
4
4
|
minecraft_datapack_language/cli.py,sha256=R4QZYtox-Da9B8pr_kCg_9qc9aI-ORTah7kMkhsI5tw,10373
|
5
5
|
minecraft_datapack_language/dir_map.py,sha256=HmxFkuvWGkzHF8o_GFb4BpuMCRc6QMw8UbmcAI8JVdY,1788
|
6
|
-
minecraft_datapack_language/mdl_compiler.py,sha256=
|
6
|
+
minecraft_datapack_language/mdl_compiler.py,sha256=9o7Q6e-jdZDn3dgitvA6KS_yGR-pQEm3pmHF3trguKs,45102
|
7
7
|
minecraft_datapack_language/mdl_errors.py,sha256=r0Gu3KhoX1YLPAVW_iO7Q_fPgaf_Dv9tOGSOdKNSzmw,16114
|
8
8
|
minecraft_datapack_language/mdl_lexer.py,sha256=dVwdgUmdQI7EJaFtoKZpq6rj5156YVjt44mMee-MDIs,23388
|
9
9
|
minecraft_datapack_language/mdl_linter.py,sha256=z85xoAglENurCh30bR7kEHZ_JeMxcYaLDcGNRAl-RAI,17253
|
10
10
|
minecraft_datapack_language/mdl_parser.py,sha256=axyjdrcgqeOpbmWolasiIZAjV_RpFaP5QiafLPXAhms,25223
|
11
11
|
minecraft_datapack_language/python_api.py,sha256=Iao1jbdeW6ekeA80BZG6gNqHVjxQJEheB3DbpVsuTZQ,12304
|
12
12
|
minecraft_datapack_language/utils.py,sha256=Aq0HAGlXqj9BUTEjaEilpvzEW0EtZYYMMwOqG9db6dE,684
|
13
|
-
minecraft_datapack_language-16.0.
|
14
|
-
minecraft_datapack_language-16.0.
|
15
|
-
minecraft_datapack_language-16.0.
|
16
|
-
minecraft_datapack_language-16.0.
|
17
|
-
minecraft_datapack_language-16.0.
|
18
|
-
minecraft_datapack_language-16.0.
|
13
|
+
minecraft_datapack_language-16.0.2.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
14
|
+
minecraft_datapack_language-16.0.2.dist-info/METADATA,sha256=b9ipiRrA7uorGpPRXtBRwUsA_yQF9_LAEu4KL96yskQ,8343
|
15
|
+
minecraft_datapack_language-16.0.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
16
|
+
minecraft_datapack_language-16.0.2.dist-info/entry_points.txt,sha256=c6vjBeCiyQflvPHBRyBk2nJCSfYt3Oc7Sc9V87ySi_U,108
|
17
|
+
minecraft_datapack_language-16.0.2.dist-info/top_level.txt,sha256=ADtFI476tbKLLxEAA-aJQAfg53MA3k_DOb0KTFiggfw,28
|
18
|
+
minecraft_datapack_language-16.0.2.dist-info/RECORD,,
|
{minecraft_datapack_language-16.0.0.dist-info → minecraft_datapack_language-16.0.2.dist-info}/WHEEL
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|