minecraft-datapack-language 16.0.4__py3-none-any.whl → 16.0.6__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.
@@ -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.4'
32
- __version_tuple__ = version_tuple = (16, 0, 4)
31
+ __version__ = version = '16.0.6'
32
+ __version_tuple__ = version_tuple = (16, 0, 6)
33
33
 
34
34
  __commit_id__ = commit_id = None
@@ -561,14 +561,17 @@ class MDLCompiler:
561
561
 
562
562
  def _while_loop_to_command(self, while_loop: WhileLoop) -> str:
563
563
  """Convert while loop to proper Minecraft loop logic."""
564
- condition = self._expression_to_condition(while_loop.condition)
565
564
  lines = []
566
565
 
567
566
  # Generate the while loop using a recursive function approach
568
567
  loop_function_name = self._generate_while_function_name()
569
568
 
570
- # First, call the loop function
571
- lines.append(f"function {self.current_namespace}:{loop_function_name}")
569
+ # First, call the loop function conditionally (true while semantics)
570
+ cond_str, invert_then = self._build_condition(while_loop.condition)
571
+ if invert_then:
572
+ lines.append(f"execute unless {cond_str} run function {self.current_namespace}:{loop_function_name}")
573
+ else:
574
+ lines.append(f"execute if {cond_str} run function {self.current_namespace}:{loop_function_name}")
572
575
 
573
576
  # Generate the loop function body
574
577
  loop_body_lines = [f"# Function: {self.current_namespace}:{loop_function_name}"]
@@ -600,8 +603,11 @@ class MDLCompiler:
600
603
  loop_body_lines.append(cmd)
601
604
 
602
605
  # Add the recursive call at the end to continue the loop
603
- cond_str, _inv = self._build_condition(while_loop.condition)
604
- loop_body_lines.append(f"execute if {cond_str} run function {self.current_namespace}:{loop_function_name}")
606
+ # Respect inverted conditions (e.g., NOT_EQUAL)
607
+ if invert_then:
608
+ loop_body_lines.append(f"execute unless {cond_str} run function {self.current_namespace}:{loop_function_name}")
609
+ else:
610
+ loop_body_lines.append(f"execute if {cond_str} run function {self.current_namespace}:{loop_function_name}")
605
611
  # Stop routing temp commands for while-body
606
612
  self._temp_sink_stack.pop()
607
613
 
@@ -619,9 +625,15 @@ class MDLCompiler:
619
625
  """
620
626
  loop_function_name = self._generate_while_function_name()
621
627
 
622
- # Schedule first iteration for next tick
628
+ # Build condition once
629
+ cond_str, invert_then = self._build_condition(while_loop.condition)
630
+
631
+ # Schedule first iteration for next tick (conditionally for true while semantics)
623
632
  lines: List[str] = []
624
- lines.append(f"schedule function {self.current_namespace}:{loop_function_name} 1t")
633
+ if invert_then:
634
+ lines.append(f"execute unless {cond_str} run schedule function {self.current_namespace}:{loop_function_name} 1t")
635
+ else:
636
+ lines.append(f"execute if {cond_str} run schedule function {self.current_namespace}:{loop_function_name} 1t")
625
637
 
626
638
  # Build the loop function body
627
639
  loop_body_lines: List[str] = [f"# Function: {self.current_namespace}:{loop_function_name}"]
@@ -655,10 +667,8 @@ class MDLCompiler:
655
667
  loop_body_lines.append(cmd)
656
668
  self._temp_sink_stack.pop()
657
669
 
658
- cond_str, invert_then = self._build_condition(while_loop.condition)
670
+ # Conditionally schedule next tick
659
671
  if invert_then:
660
- # Inverted means schedule unless condition (NOT desired). We want continue-when-true.
661
- # cond_str represents equality in inverted case; continue when not(cond) → use unless.
662
672
  loop_body_lines.append(f"execute unless {cond_str} run schedule function {self.current_namespace}:{loop_function_name} 1t")
663
673
  else:
664
674
  loop_body_lines.append(f"execute if {cond_str} run schedule function {self.current_namespace}:{loop_function_name} 1t")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: minecraft-datapack-language
3
- Version: 16.0.4
3
+ Version: 16.0.6
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
@@ -1,18 +1,18 @@
1
1
  minecraft_datapack_language/__init__.py,sha256=0KVXBE4ScRaRUrf83aA2tVB-y8A_jplyaxVvtHH6Uw0,1199
2
- minecraft_datapack_language/_version.py,sha256=L1SqJ5yirtp0CEsOA8Rvu0Ugibk5GmwrYFW7YofqfpU,706
2
+ minecraft_datapack_language/_version.py,sha256=GktcYCenAP831q4eBOLrtugwsx-bWcqxBrKMf5xGoJY,706
3
3
  minecraft_datapack_language/ast_nodes.py,sha256=L5izavSeXDr766vsfRvJrcnflXNJyXcy0WSfyJPq2ZA,4484
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=rYNaxvVRje2ot1RaUHibF4HItxca2MovntH0kjx65Vc,47808
6
+ minecraft_datapack_language/mdl_compiler.py,sha256=L9Q6LphnXe8K7OWSJHimUCKDx0acB1aj5byNa9JwZgw,48295
7
7
  minecraft_datapack_language/mdl_errors.py,sha256=r0Gu3KhoX1YLPAVW_iO7Q_fPgaf_Dv9tOGSOdKNSzmw,16114
8
8
  minecraft_datapack_language/mdl_lexer.py,sha256=rfsW2QNcZxa9HAHpU9HFReshQSmjOrrK6xY_r43mKFk,23485
9
9
  minecraft_datapack_language/mdl_linter.py,sha256=z85xoAglENurCh30bR7kEHZ_JeMxcYaLDcGNRAl-RAI,17253
10
10
  minecraft_datapack_language/mdl_parser.py,sha256=Krk7Y_E9OKNCcsDOCT7ATvQLbJII951AU2qzEY00GLE,26068
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.4.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
14
- minecraft_datapack_language-16.0.4.dist-info/METADATA,sha256=QeiAuNVchg2GoUT3GuculpnG2bCduaghGAALoTcyy9Q,8343
15
- minecraft_datapack_language-16.0.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
16
- minecraft_datapack_language-16.0.4.dist-info/entry_points.txt,sha256=c6vjBeCiyQflvPHBRyBk2nJCSfYt3Oc7Sc9V87ySi_U,108
17
- minecraft_datapack_language-16.0.4.dist-info/top_level.txt,sha256=ADtFI476tbKLLxEAA-aJQAfg53MA3k_DOb0KTFiggfw,28
18
- minecraft_datapack_language-16.0.4.dist-info/RECORD,,
13
+ minecraft_datapack_language-16.0.6.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
14
+ minecraft_datapack_language-16.0.6.dist-info/METADATA,sha256=k4NkTwVi-19LZGndmCVoaYXKbws7tvt5pDNrPFuLBSU,8343
15
+ minecraft_datapack_language-16.0.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
16
+ minecraft_datapack_language-16.0.6.dist-info/entry_points.txt,sha256=c6vjBeCiyQflvPHBRyBk2nJCSfYt3Oc7Sc9V87ySi_U,108
17
+ minecraft_datapack_language-16.0.6.dist-info/top_level.txt,sha256=ADtFI476tbKLLxEAA-aJQAfg53MA3k_DOb0KTFiggfw,28
18
+ minecraft_datapack_language-16.0.6.dist-info/RECORD,,