Skip to content

Commit

Permalink
fix: don't nest location when the subcommand redirects to execute
Browse files Browse the repository at this point in the history
  • Loading branch information
vberlier committed Jan 16, 2024
1 parent 9954bd6 commit adcaf9c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,5 @@ function ~/../upthis:

append function ~/thing:
function #~/ddd

execute if function ~/condition run function ~/action
2 changes: 2 additions & 0 deletions mecha/contrib/nested_location.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ def walk_location_hierarchy(
if (
node
and node.parser == "minecraft:function"
and (tail := self.spec.tree.get(*command.identifier.split(":")))
and tail.redirect != ("execute",)
and isinstance(argument_node, AstResourceLocation)
):
if argument_node is not last:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
function demo:foo
function demo:foo/thing
function demo:thing
execute if function demo:foo/condition run function demo:foo/action
```

`@function demo:bar/thing`
Expand Down

0 comments on commit adcaf9c

Please sign in to comment.