Robot's Datapack Tools 图标

Robot's Datapack Tools

作者:rebot | 分类:模组

价格:0 墨喵币 下载量:0 点赞:0 版本 1.1.0
本资源为搬运资源,原资源地址: https://modrinth.com/mod/robots-datapack-tools
资源信息

Minecraft 版本: 1.21.5 1.21.6 1.21.7 1.21.8 1.21.9 1.21.10 1.21.11

平台: datapack

标签: library

资源介绍
![Banner](https://cdn.modrinth.com/data/cached_images/e5dae51c231500d645895f17193959be6ab0a77a.png) [![Discord](https://cdn.modrinth.com/data/cached_images/f0cf0180cbd5c4367ffae3af2f032bb768cd1a56.png)](https://discord.com/invite/eZEHeNbzUE) [![YouTube](https://cdn.modrinth.com/data/cached_images/ea2b7719efdde91eec7c454f534788ffc096c9e5.png)](https://www.youtube.com/@GoldenRobotII)

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, and the datapack is made very efficient by using as little ticking functions as possible.

Custom Features

Blocks The custom blocks use a [marker](https://minecraft.wiki/w/Marker) as main entity and six [item displays](https://minecraft.wiki/w/Display#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..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](https://discord.com/invite/eZEHeNbzU). ## **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](https://minecraft.wiki/w/Items_model_definition) from the assets//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](https://minecraft.wiki/w/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 [interaction](https://minecraft.wiki/w/Interaction) 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 **a placed block**. This **doesn't** 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](https://minecraft.wiki/w/Items_model_definition) from the assets//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` [component](https://minecraft.wiki/w/Data_component_format#entity_data) 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 [item display](https://minecraft.wiki/w/Display#Item_Displays) as main entity and an [interaction](https://minecraft.wiki/w/Interaction). If you want to run functions on a custom crop, use the tag ```rdt.crop..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 [the discord server](https://discord.com/invite/eZEHeNbzU). **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](https://minecraft.wiki/w/Items_model_definition) from the assets//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](https://minecraft.wiki/w/Loot_table) 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` [component](https://minecraft.wiki/w/Data_component_format#custom_data) 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` [component](https://minecraft.wiki/w/Data_component_format#consumable). 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 all the namespaces 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 the discord server or watch this video: How to intergrate Robot's Datapack Tools

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.

下载太慢?试试 墨喵加速站,支持 Modrinth 和外网直链高速下载! 用的人越多,下载的越快!
下载与版本
评论(0)
登录 后发表评论。

暂无评论,抢个沙发吧~

举报此资源

请登录后举报

🔥 相关推荐
Quaxlyy's Pack

价格:0 墨喵币
下载量:0

查看详情
NovaClient

价格:0 墨喵币
下载量:0

查看详情
Minecraft Heroes 2 Green Hearts Old

价格:0 墨喵币
下载量:0

查看详情
Round Logs - Heycronus

价格:0 墨喵币
下载量:0

查看详情