-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: reset generator to prevent dropping tokens
- Loading branch information
Showing
9 changed files
with
126 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
require: | ||
- bolt | ||
data_pack: | ||
load: "src" | ||
pipeline: | ||
- mecha |
52 changes: 52 additions & 0 deletions
52
examples/bolt_summon/src/data/demo/functions/foo.mcfunction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
from nbtlib import List, String | ||
|
||
SUMMON_INIT_TAG = "custom_summon_init" | ||
|
||
macro | ||
summon | ||
entity=minecraft:entity_summon | ||
pos=minecraft:vec3 | ||
nbt=minecraft:nbt_compound_tag | ||
body=mecha:nested_root: | ||
nbt = nbt.evaluate() | ||
nbt.setdefault("Tags", List[String]()).append(String(SUMMON_INIT_TAG)) | ||
summon entity pos nbt | ||
as @e[type=entity.get_canonical_value(), tag=SUMMON_INIT_TAG] at @s: | ||
yield body | ||
tag @s remove SUMMON_INIT_TAG | ||
|
||
# Overload to make nbt optional | ||
macro | ||
summon | ||
entity=minecraft:entity_summon | ||
pos=minecraft:vec3 | ||
body=mecha:nested_root: | ||
summon entity pos {}: | ||
yield body | ||
|
||
# Overload to make pos optional | ||
macro | ||
summon | ||
entity=minecraft:entity_summon | ||
body=mecha:nested_root: | ||
summon entity ~ ~ ~: | ||
yield body | ||
|
||
summon zombie ~ ~ ~ {Tags: ["my_custom_mob"]}: | ||
say Hello I just spawned! | ||
effect give @e[distance=..3] poison | ||
|
||
summon zombie 1 2 3: | ||
say no nbt | ||
|
||
summon zombie 1 2 3: | ||
Tags: ["using_nested_yaml"] | ||
|
||
summon zombie: | ||
say no position or nbt | ||
|
||
def wtf(): | ||
say hello | ||
|
||
summon zombie ~1 ~2 ~3: | ||
wtf() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#>ERROR Expected colon but reached end of file. | ||
#>ERROR Expected colon but got newline '\n'. | ||
# line 1, column 25 | ||
# 1 | append function demo:foo | ||
append function demo:foo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# Lectern snapshot | ||
|
||
## Data pack | ||
|
||
`@data_pack pack.mcmeta` | ||
|
||
```json | ||
{ | ||
"pack": { | ||
"pack_format": 10, | ||
"description": "" | ||
} | ||
} | ||
``` | ||
|
||
### demo | ||
|
||
`@function demo:foo` | ||
|
||
```mcfunction | ||
summon zombie ~ ~ ~ {Tags: ["my_custom_mob", "custom_summon_init"]} | ||
execute as @e[type=minecraft:zombie, tag=custom_summon_init] at @s run function demo:foo/nested_execute_0 | ||
summon zombie 1 2 3 {Tags: ["custom_summon_init"]} | ||
execute as @e[type=minecraft:zombie, tag=custom_summon_init] at @s run function demo:foo/nested_execute_1 | ||
summon zombie 1 2 3 {Tags: ["using_nested_yaml"]} | ||
summon zombie ~ ~ ~ {Tags: ["custom_summon_init"]} | ||
execute as @e[type=minecraft:zombie, tag=custom_summon_init] at @s run function demo:foo/nested_execute_2 | ||
summon zombie ~1 ~2 ~3 {Tags: ["custom_summon_init"]} | ||
execute as @e[type=minecraft:zombie, tag=custom_summon_init] at @s run function demo:foo/nested_execute_3 | ||
``` | ||
|
||
`@function demo:foo/nested_execute_0` | ||
|
||
```mcfunction | ||
say Hello I just spawned! | ||
effect give @e[distance=..3] poison | ||
tag @s remove custom_summon_init | ||
``` | ||
|
||
`@function demo:foo/nested_execute_1` | ||
|
||
```mcfunction | ||
say no nbt | ||
tag @s remove custom_summon_init | ||
``` | ||
|
||
`@function demo:foo/nested_execute_2` | ||
|
||
```mcfunction | ||
say no position or nbt | ||
tag @s remove custom_summon_init | ||
``` | ||
|
||
`@function demo:foo/nested_execute_3` | ||
|
||
```mcfunction | ||
say hello | ||
tag @s remove custom_summon_init | ||
``` |