You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
summon falling_block ~ ~1 ~ {BlockState:{Name:redstone_block},Passengers:[{id:falling_block,BlockState:{Name:activator_rail}},{id:command_block_minecart,Command:'gamerule commandBlockOutput false'},{id:command_block_minecart,Command:'say as second lame command'},{id:command_block_minecart,Command:'say third lamer command lol'},{id:command_block_minecart,Command:'tellraw @a "look ma I\'m using quotes \\\\/!"'},{id:command_block_minecart,Command:'tellraw @a[name=!"Slackow"] "say \\"lol\\""'},{id:command_block_minecart,Command:'setblock ~ ~1 ~ command_block{auto:1b,Command:"fill ~ ~ ~ ~ ~-3 ~ air"}'},{id:command_block_minecart,Command:'kill @e[type=command_block_minecart,distance=..1]'}]}
209
209
```
210
210
## `ns` String
211
211
The `ns` global variable lets you access the namespace of the dps file you are in as a string. note that `ns` is the namespace of the *source* file, not the function you are in.
212
212
```
213
-
=== data/example_pack/sources/example.dps ===
213
+
=== data/example_pack/source/example.dps ===
214
214
/function say_something:
215
215
/say something!
216
216
/function example:
@@ -219,11 +219,11 @@ The `ns` global variable lets you access the namespace of the dps file you are i
@@ -281,12 +281,14 @@ add lines or create new files.
281
281
# FunctionPackScript
282
282
Most files shown so far have been `.dps` files, standing for DataPackScript,
283
283
but there's also FunctionPackScript with `.fps` files. These are contained in the root of the input directory instead
284
-
of under a proper datapack with a namespace underneath sources, these are meant for generating independent
284
+
of under a proper datapack with a namespace underneath `source`[<sup>[1]</sup>](#f1), these are meant for generating independent
285
285
function files easily, usually those with repetitive lines. In these files you cannot use create statements, but you can generate
286
286
additional functions. All the generated function files
287
287
will have their namespace ignored and be generated in the same directory
288
288
as the main generated function.
289
289
290
+
<spanid="f1">[1]</span>: In older versions of minecraft (pre 1.21) this folder is `sources` instead. PackScript will automatically figure out which folder name to use based on your pack_format value in your `pack.mcmeta`.
291
+
290
292
# The CLI
291
293
This tool has two main actions it can perform: compiling packs and initializing templates.
292
294
-`python3 packscript.py c` (you can also use compile or comp)
@@ -300,7 +302,7 @@ More actions:
300
302
## Compile Options
301
303
-`-i/--input <dir>` specify the directory of the pack you are compiling defaults to current dir.
302
304
-`-o/--output <dir/zip>` specify the output of the pack (can output zip too) defaults to `output`
303
-
-`-s/--sources` output the source files into the resulting pack, by default they get deleted
305
+
-`-s/--source` output the source files into the resulting pack, by default they get deleted
304
306
-`-v/--verbose` print out all the generated Python code with line numbers. Very good for debugging.
305
307
306
308
## Init Options
@@ -350,6 +352,6 @@ In this case it's because there's a letter before the command line, making it ge
350
352
4.**Create A Datapack.** Run `python3 packscript.py init` in order to create a datapack with
351
353
PackScript. You'll be prompted for information about the datapack.
352
354
You should have a new datapack, you can put files in there as usual for them to
353
-
be outputted, files in `<pack>/data/*/sources/*.dps` and `<pack>/*.fps` will be interpreted as PackScript
355
+
be outputted, files in `<pack>/data/*/source/*.dps` and `<pack>/*.fps` will be interpreted as PackScript
354
356
on compilation. By default, you will find a main.dps file there.
355
357
5.**Compile Datapack.** To compile, run `python3 packscript.py compile -i <datapack directory> -o <output>`
0 commit comments