Robot's Datapack Tools
This datapack library adds multiple tools which make datapack creation easier.
Quick challenge
How far can you run before the mobs catch you?
Minecraft check
Confirm your run
Complete the quick check to get your code.
Robot's Datapack Tools

About
Robot's Datapack Tools is a library that can be intergrated into your own project. It adds multiple tools that make datapack creation easier, such as adding blocks with only one command. This is almost entirely done using macros#Macros), and the datapack is made very efficient by using as little ticking functions as possible.
Custom Features
Blocks
The custom blocks use a marker as main entity and six item displays to render the block with correct lighting on each side. These item display don't tick, and therefore this is still very lag friendly. If you want to run functions on a custom block, use the tag ```rdt.block.<id>.marker``` to access the main marker of the block. If you don't understand how to add custom blocks, check out the example at the bottom or join the discord server.
Commands
```function block:add {...}```
This command is used to register new blocks. Run this function within the `load` function of your datapack. The following tags are required:
|tag|type|description| |---|----|-----------| |`id`|string|unique id of the block. (Allowed characters include: `-`, `+`, `.`, `_`, `A`-`Z`, `a`-`z`, and `0`-`9`)| |`block`|string|Any minecraft block. Make sure this block drops itself when broken. This block will define hardness, particles and breaking sound.| |`model`|string|item model from the assets/<namespace>/items folder| |`type`|string|how to orientate the block when placed:
1. `default`: no orientation
2. `facing`: face towards player
3. `facing_horizontal`: face towards player, but not up or down
4. `column`: face depending on the side of the block it's placed on| |`loot_table`|string|loot table that drops when the block is broken| |`config`|compound|list of config tags. Leave empty if no config is needed|
```function block:add {config:{...}}```
Within the `config` compound you can specify the following settings. They are not required.
|tag|description|sub-tags|type|description| |---|---|---|---|---| |`interactable`|summons an doesn't entity|1. `attack`
2. `interact`
3. `break_on_attack`
4. `response`|1.string
2.string
3.empty
4.empty|1. function to run when left-clicked
2. function to run when right-clicked
3. add this tag if the block should break when left-clicked
4. the interaction will have the response:1b tag| |`function`|functions to run|1. `place`
2. `break`
3. `tick`|1.string
2.string
3.string| 1. function that runs when placed
2. function that runs when broken
3. function that runs every tick| |`place_sound`|sound to play when the block is placed. If this tag is not included, it will play `block.stone.place`|1. `sound`
2. `pitch`|1.string
2.float|1. sound id to play
2. pitch, ranging from 0.0 to 2.0| |`item`|If the loot table specified in the `loot_table` tag doesn't drop the custom item by itself, create an additional loot table that drops the custom item and put it here.|-|string|-|
```function block:list```
Lists all the custom blocks that have been added.
```function block:remove {id:...}```
Used to remove a custom block. `id` should be set to the unique id used when adding the block. This command will not remove the custom blocks from your world, that has to be done manually!
```function block:edit/... {...}```
Using this function you can change specific features of main entity. This main entity edit all existing custom blocks of that type. Make sure when running this function it runs on the main entity. The command can be one of the following:
|`function block:edit/...`|description|tags|type|description| |---|---|---|---|---| |`model`|changes the model of this specific block|`model`|string|item model from the assets/<namespace>/items folder| |`attack`|changes the attack function that runs when left-clicking the block|`function`|string|the function to run| |`interact`|changes the interact function that runs when right-clicking the block|`function`|string|the function to run|
Custom Item
To be able to place these custom blocks, you will need a custom item. The custom item has to meet the following criteria: * The item must be an `item_frame` or a `glow_item_frame`, * The item must have an `entity_data` can containing ```{id:"minecraft:item_frame",Tags:["rdt.block","id"]}``` with `"id"` being the unique id of the custom block you want to place * It is recommended that the item also has the `entity_data` component containing `{Silent:1b,Fixed:1b,Invisible:1b,Invulnerable:1b}` * Any other data in `entity_data` is not allowed. The item can contain other components, such as `item_name` or `item_model`.
Example
In this example we will add a custom block that looks like oak planks but can be rotated. In this case we have an extra data pack named `custom`, containing a custom loot table and a load function. In the load function, we add the following command to register the block: ``` function block:add {id:"rotate_oak_planks",block:"oak_planks",model:"minecraft:oak_planks",type:"facing_horizontal",loot_table:"custom:blocks/rotate_oak_planks",config:{place_sound:{sound:"minecraft:block.wood.place",pitch:0.8f}}} ``` Then, we can give ourselfs the item to place the custom block using the following command: ``` give @p glow_item_frame[entity_data={id:"minecraft:glow_item_frame",Fixed:1b,Invisible:1b,Silent:1b,Invulnerable:1b,Tags:["rdt.block","rotate_oak_planks"]},item_model="oak_planks",item_name="Rotatable Oak Planks"] ``` If we would want to change the model of the closest custom block to dark oak planks we can use the following command: ``` execute as @n[tag=rdt.block.rotate_oak_planks.marker] run function block:edit/model {model:"dark_oak_planks"} ```
Crops
The custom crops use an Custom crops use a tripwire in its deactivated state as a base block. This feature itself is no longer used in Minecraft, so removing its texture shouldn't be a problem. as main entity and an %%MD1%%. If you want to run functions on a custom crop, use the tag ```rdt.crop.<id>.display``` to access the main item display of the block. If you don't understand how to add custom blocks, check out the example at the bottom or join %%MD2%%. Custom crops use a tripwire in its deactivated state as a base block. This feature itself is no longer used in Minecraft, so removing its texture shouldn't be a problem.
Commands
```function crop:add {...}```
This command is used to register new crops. Run this function within the `load` function of your datapack. The following tags are required:
|tag|type|description| |---|----|-----------| |`id`|string|unique id of the crop. (Allowed characters include: `-`, `+`, `.`, `_`, `A`-`Z`, `a`-`z`, and `0`-`9`)| |`stages`|int|amount of stages the crop should have| |`model`|array of strings|item model from the assets/<namespace>/items folder. One model per stage is required.| |`hitbox`|array of floats|height of the interaction entity per stage. Minimum height of 0.22f| |`loot_table`|array with 2 strings|Two loot tables that drop when the crop is broken. The first loot table drops if the crop is not fully grown, the second loot table drops if the crop is fully grown.|
```function crop:list```
Lists all the custom crop that have been added.
```function crop:remove {id:...}```
Used to remove a custom crop. `id` should be set to the unique id used when adding the crop. This command will not remove the custom crops from your world, that has to be done manually!
Custom Item
To be able to place these custom crops, you will need a custom item. The custom item has to meet the following criteria: * The item must have a `custom_data` can containing `{rdt:"crop",id:"id"}` with `"id"` being the unique id of the custom crop you want to place * The item must be consumable by default, or have the `consumable` %%MD1%%. If you don't want the item to be edible, add the setting `{consume_seconds:999999}` in the `consumable` component. * The item can contain other components, such as `item_name` or `item_model`, and you can add more data in the `custom_data` component
Example
In this example we will add a custom crop with 4 stages, growing from a red carpet to red concrete. In this case we have an extra data pack named `custom`, containing two custom loot tables and a load function. In the load function, we add the following command to register the block: ``` function crop:add {id:"red_crop",stages:4,model:["minecraft:red_carpet","minecraft:crimson_trapdoor","minecraft:crimson_slab","minecraft:red_concrete"],hitbox:[0.2d,0.2d,0.5d,1.0d],loot_table:["custom:blocks/red_crop_not_grown","custom:blocks/red_crop_grown"]} ``` Then, we can give ourselfs the item to place the custom crop using the following command: ``` give @p red_dye[minecraft:custom_data={rdt:"crop",id:"red_crop"},minecraft:consumable={consume_seconds:999999},item_name="Red Crop Seeds"] ```
Usage
To intergrate this datapack, download the latest version, unzip it and copy before the before over into your own datapack. Make sure to mention the function `rdt:load` in the `load.json` file, and mention the function `rdt:tick` in the `tick.json` file. It is recommended to mention these functions before your own load and tick functions. If you need more help, join %%MD1%% or watch this video: %%MD2%%
When running functions from this datapack it is not recommended to run functions under the `rdt` namespace.
If you have suggestions or want to report bugs, create a post with the tag `Robot's Datapack Tools` in the discord server, in the channels `💡︱ideas` and `🟡bugs` respectively.
License
Robot's Datapack Tools © 2025 by GoldenRobot II is licensed under CC BY 4.0. You are free to share and adapt the material, but you are required to provide appropriate credit.

