A simple way to generate Datapacks
npm install @macro21kgb/create-datapack
npm i -g @macro21kgb/create-datapack
`
After that you can create a new datapack in the current directory with
`
create-datapack
`
or
`
npx create-datapack
`
You can also see more info with
`
create-datapack --help
`
AVAILABLE MODULES
Now with this command you can access different modules for any occasion
- The Structure-Generator, It will generate a structure given from a template (see below), you simply create in the root directory of your datapack, a "structures" folder and the structure file (the file are with .mcs extension)
- The Auto-uninstaller,It will scan your datapack an create an uninstall.mcfunction just for you, (run it in the root directory, where is the pack.mcmeta file)
- The Summon-Give Convert, Convert your commands into give to summon or summon to give (a little bit buggy but it is ok for most thing)
- The Generator-Sites Module, This will give you the link of some of my custom generators (floor-crafting and crafting table recipe)
`
create-datapack -m
or
create-datapack --modules
`
Template System for datapacks template (.mclate)
The templates are written in a custom language, it is very simple and easy to use, below there is an example of everything you can do:
`
<###>Test Template <-- name of the template, must be first line
<===functions:load <-- location of the file : name of the function without extension (auto-added)
scoreboard objectives add tf_rc dummy
scoreboard objectives add tf_detection minecraft.used:minecraft.carrot_on_a_stick
===>
<===functions:main
execute as @a[scores={tf_detection=1..}] at @s run say CLICK
execute as @a[scores={tf_detection=1..}] at @s run function NAMESPACE:start_raycast
execute as @a[scores={tf_detection=1..}] at @s run scoreboard players set @s tf_detection 0
===>
<===functions/test/subfolder:test <-- you can create sub-folder easily like that
say super duper test
===>
<===tags/blocks:passable_blocks <-- NOT only functions!
{
"values":[
"minecraft:air",
"minecraft:void_air",
"minecraft:cave_air",
"minecraft:water",
"minecraft:lava",
"minecraft:grass"
}
===>
`
$3
Name of the template
`
<###>This is the Name of the Template
`
File start and end markers (you can obviously create multiple files in a template):
`
<===file_location/folder:name_of_the_file <-- start of a file
===> <-- end of the file
`
When executing function and you need the namespace of the datapack, set it like this (use NAMESPACE):
`elixir
<===functions:main
execute as @a[scores={tf_detection=1..}] at @s run say CLICK
execute as @a[scores={tf_detection=1..}] at @s run function NAMESPACE:start_raycast <-- the namespace is taken automatically
execute as @a[scores={tf_detection=1..}] at @s run scoreboard players set @s tf_detection 0
===>
`
Template System for Structures (.mcs)
The template syntax is very simple and easy to use, you simply create your structure layer by layer.
This schematic will create a 3x3 cube of stone with an hole in the middle:
`
S S S <-- this is the first layer
S S S <-- space between each symbol
S S S
--- <-- three "-", it means to go up one level
S S S <-- this is the second layer and so on...
S A S
S S S
---
S S S
S S S
S S S
=== <-- it means that the schematic is finished
S minecraft:stone <-- symbol block_associated_with
A minecraft:air
``