minecraft-datapack-language 15.3.8__py3-none-any.whl → 15.3.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 +52 -26
- {minecraft_datapack_language-15.3.8.dist-info → minecraft_datapack_language-15.3.10.dist-info}/METADATA +1 -1
- {minecraft_datapack_language-15.3.8.dist-info → minecraft_datapack_language-15.3.10.dist-info}/RECORD +8 -8
- {minecraft_datapack_language-15.3.8.dist-info → minecraft_datapack_language-15.3.10.dist-info}/WHEEL +0 -0
- {minecraft_datapack_language-15.3.8.dist-info → minecraft_datapack_language-15.3.10.dist-info}/entry_points.txt +0 -0
- {minecraft_datapack_language-15.3.8.dist-info → minecraft_datapack_language-15.3.10.dist-info}/licenses/LICENSE +0 -0
- {minecraft_datapack_language-15.3.8.dist-info → minecraft_datapack_language-15.3.10.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.10'
|
32
|
+
__version_tuple__ = version_tuple = (15, 3, 10)
|
33
33
|
|
34
34
|
__commit_id__ = commit_id = None
|
@@ -218,7 +218,7 @@ def _generate_load_function(scoreboard_commands: List[str], output_dir: Path, na
|
|
218
218
|
f.write('\n'.join(load_content))
|
219
219
|
|
220
220
|
|
221
|
-
def _process_say_command_with_variables(content: str, selector: str) -> str:
|
221
|
+
def _process_say_command_with_variables(content: str, selector: str, variable_scopes: Dict[str, str] = None) -> str:
|
222
222
|
"""Process say command content with variable substitution, converting to tellraw with score components."""
|
223
223
|
import re
|
224
224
|
|
@@ -229,7 +229,33 @@ def _process_say_command_with_variables(content: str, selector: str) -> str:
|
|
229
229
|
if content.startswith('"') and content.endswith('"'):
|
230
230
|
content = content[1:-1] # Remove surrounding quotes
|
231
231
|
|
232
|
-
#
|
232
|
+
# First, check for MDL-style variable references (no $ symbols)
|
233
|
+
# Look for common variable names that might be in the content
|
234
|
+
if variable_scopes:
|
235
|
+
for var_name, var_scope in variable_scopes.items():
|
236
|
+
if var_name in content:
|
237
|
+
# Found a variable reference, convert to score component
|
238
|
+
if var_scope == 'global':
|
239
|
+
var_selector = "@e[type=armor_stand,tag=mdl_server,limit=1]"
|
240
|
+
else:
|
241
|
+
var_selector = var_scope
|
242
|
+
|
243
|
+
# Split content around the variable
|
244
|
+
parts = content.split(var_name)
|
245
|
+
if len(parts) == 2:
|
246
|
+
# Build tellraw components
|
247
|
+
components = []
|
248
|
+
if parts[0]: # Text before variable
|
249
|
+
components.append(f'{{"text":"{parts[0]}"}}')
|
250
|
+
# Variable as score component
|
251
|
+
components.append(f'{{"score":{{"name":"{var_selector}","objective":"{var_name}"}}}}')
|
252
|
+
if parts[1]: # Text after variable
|
253
|
+
components.append(f'{{"text":"{parts[1]}"}}')
|
254
|
+
|
255
|
+
components_str = ','.join(components)
|
256
|
+
return f'tellraw @a [{components_str}]'
|
257
|
+
|
258
|
+
# Fallback: Look for traditional $variable$ syntax
|
233
259
|
var_pattern = r'\$([^$]+)\$'
|
234
260
|
matches = re.findall(var_pattern, content)
|
235
261
|
|
@@ -303,7 +329,7 @@ def _process_statement(statement: Any, namespace: str, function_name: str, state
|
|
303
329
|
content = command[4:] # Remove "say " prefix
|
304
330
|
print(f"DEBUG: Say command content: {repr(content)}")
|
305
331
|
# Convert to Minecraft tellraw format
|
306
|
-
processed_command = _process_say_command_with_variables(content, selector)
|
332
|
+
processed_command = _process_say_command_with_variables(content, selector, variable_scopes)
|
307
333
|
print(f"DEBUG: Processed say command: {repr(processed_command)}")
|
308
334
|
commands.append(processed_command)
|
309
335
|
elif command.startswith('tellraw @a ') or command.startswith('tellraw @ a '):
|
@@ -805,29 +831,29 @@ def _ast_to_pack(ast: Dict[str, Any], mdl_files: List[Path]) -> Pack:
|
|
805
831
|
else:
|
806
832
|
# Simple function call without scope
|
807
833
|
function.commands.append(f"function {func_namespace}:{func_name}")
|
808
|
-
|
809
|
-
|
810
|
-
|
811
|
-
|
812
|
-
|
813
|
-
|
814
|
-
|
815
|
-
|
816
|
-
|
817
|
-
|
818
|
-
|
819
|
-
|
820
|
-
|
821
|
-
|
822
|
-
|
823
|
-
|
824
|
-
|
825
|
-
|
826
|
-
|
827
|
-
|
828
|
-
|
829
|
-
|
830
|
-
|
834
|
+
elif statement.get('type') == 'variable_assignment':
|
835
|
+
# Handle variable assignments
|
836
|
+
var_name = statement['name']
|
837
|
+
value = statement['value']
|
838
|
+
|
839
|
+
# Determine selector based on variable scope
|
840
|
+
var_selector = "@s" # Default
|
841
|
+
if 'variables' in ast:
|
842
|
+
for var_decl in ast['variables']:
|
843
|
+
if var_decl.get('name') == var_name:
|
844
|
+
var_scope = var_decl.get('scope')
|
845
|
+
if var_scope == 'global':
|
846
|
+
var_selector = "@e[type=armor_stand,tag=mdl_server,limit=1]"
|
847
|
+
elif var_scope:
|
848
|
+
var_selector = var_scope
|
849
|
+
break
|
850
|
+
|
851
|
+
if hasattr(value, 'value'):
|
852
|
+
# Simple literal value
|
853
|
+
function.commands.append(f"scoreboard players set {var_name} {var_selector} {value.value}")
|
854
|
+
else:
|
855
|
+
# Complex expression - add a placeholder
|
856
|
+
function.commands.append(f"# Variable assignment: {var_name} = {value}")
|
831
857
|
else:
|
832
858
|
# Add a placeholder for other statement types
|
833
859
|
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.10
|
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=jlQaM5mHBhSD-7nY4sOnfZHzOvMmAugJtfBhm4Zwqis,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=bPgcawetrB3c076uqSGILFNAPIfYpn8So4wICa93Bqw,47329
|
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.10.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
20
|
+
minecraft_datapack_language-15.3.10.dist-info/METADATA,sha256=s11HAIHRS-uAI_zTVPeIJkp9ol4X6rGxwZ9PEHKLfCo,35230
|
21
|
+
minecraft_datapack_language-15.3.10.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
22
|
+
minecraft_datapack_language-15.3.10.dist-info/entry_points.txt,sha256=c6vjBeCiyQflvPHBRyBk2nJCSfYt3Oc7Sc9V87ySi_U,108
|
23
|
+
minecraft_datapack_language-15.3.10.dist-info/top_level.txt,sha256=ADtFI476tbKLLxEAA-aJQAfg53MA3k_DOb0KTFiggfw,28
|
24
|
+
minecraft_datapack_language-15.3.10.dist-info/RECORD,,
|
{minecraft_datapack_language-15.3.8.dist-info → minecraft_datapack_language-15.3.10.dist-info}/WHEEL
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|