- check_circle Functions
- 4,186 views, 2 today
- 149 downloads, 0 today
267
Place on Head [Datapack Edition]
LegopitstopThis data pack basically adds something similar to the /head command but for vanilla Minecraft. Using a trigger command you can swap/place the item/block that you are holding into the head slot. Theirs no useful functions for placing it on your head but some blocks look pretty cool. This is only possible in the 1.17 snapshot (20w46a) using the /item command.
Commands
Swap the item that you are holding to place it on your head.
/trigger head
tested on 1.17 snapshot 20w46ashould work on any version 20w56a and up unless future versions change the /item command.
Custom Item API
Overview
You can apply custom NBT tags to an item so it shows any text when a player places it on their head via the trigger command. Below you can find an example item "Space Helmet". There are multiple pre-set formats as well as full customizability to the text, even more than v1.0.0
Version System
v1.1.0+ will now require the head item to have its builder version. For example, if you made an item from v1.0.0 you will have to add the version 1.0.0, it should look something like this Version:"[1.0.0]" This will load the older builder meaning you will not need the Type as that was added in v1.1.0. You can also just define the latest and it will load the latest builder version. The code should look like this Version:"{latest-version}". If you put an invalid version it will tell you when you do /trigger head. If there is a part of the code that is missing that the builder needs it will most likely not display anything depending on what type you selected.
Type System
Type:"renamed"
This will automaticly make the text italic and add single quotes around the text, (Does not except RAW JSON/Formating)
Type:"identifier"
This will use a custom item id. Note that "id" is not located inside the "head" object. (I use this custom ID for all my current/new data packs that add "new" items, It makes things easier.) (Does not except RAW JSON/Formatting)
Type:"custom_name"
This is similar to the old code from v1.0.0 but has the new Version and Type systems. (Excepts RAW JSON/Formatting)
Type:"custom_all"
This is where you can completely customize the text that is displayed when you do /trigger head. (Excepts RAW JSON/Formatting)
EXAMPLE ITEM
Get "Space Helmet" Item
You can apply custom NBT tags to an item so it shows any text when a player places it on their head via the trigger command. Below you can find an example item "Space Helmet". There are multiple pre-set formats as well as full customizability to the text, even more than v1.0.0
Version System
v1.1.0+ will now require the head item to have its builder version. For example, if you made an item from v1.0.0 you will have to add the version 1.0.0, it should look something like this Version:"[1.0.0]" This will load the older builder meaning you will not need the Type as that was added in v1.1.0. You can also just define the latest and it will load the latest builder version. The code should look like this Version:"{latest-version}". If you put an invalid version it will tell you when you do /trigger head. If there is a part of the code that is missing that the builder needs it will most likely not display anything depending on what type you selected.
Type System
Type:"renamed"
This will automaticly make the text italic and add single quotes around the text, (Does not except RAW JSON/Formating)
{head:{Version:"[1.1.0]",Type:"renamed",Name:"<Text to show up>"}}
Swapped head item with 'Renamed Item Format'Type:"identifier"
This will use a custom item id. Note that "id" is not located inside the "head" object. (I use this custom ID for all my current/new data packs that add "new" items, It makes things easier.) (Does not except RAW JSON/Formatting)
{id:"custom:custom_item_identifier",head:{Version:"[1.1.0]"},Type:"identifier"}}
Swapped head item with custom:custom_item_identifierType:"custom_name"
This is similar to the old code from v1.0.0 but has the new Version and Type systems. (Excepts RAW JSON/Formatting)
{head:{Version:[1.1.0],Type:"custom_name",Name:'{"text":"Custom Name Text","color":"aqua"}'}}
Swapped head item with Custom Name TextType:"custom_all"
This is where you can completely customize the text that is displayed when you do /trigger head. (Excepts RAW JSON/Formatting)
{head:{Version:"[1.1.0]",Type:"custom_all",Name:'[{"text":"Begin: ","color":"dark_aqua"},{"text":"Custom Name text","color":"aqua"}]'}}
Begin: Custom Name TextEXAMPLE ITEM
Get "Space Helmet" Item
give @p minecraft:tinted_glass{id:"custom:space_helmet",head:{Version:"{latest-version}",Type:"identifier"}},display:{Name:'{"text":"Space Helmet","italic":false}',Lore:['{"translate":"Use %s to place on head","color":"dark_gray","italic":false,"with":[{"text":"/trigger head","color":"gray","italic":true}]}']}}
Legopitstop's Common License
Credit | Legopitstop |
Compatibility | Minecraft 1.17 |
Tags |
2 Update Logs
Update #2 : by legopitstop 09/06/2021 9:17:46 amSep 6th, 2021
CHANGELOG v1.2.0
General
- Added custom pack icon.
- Updated to work for 1.17 and 1.17.1 (changes to /item command)
- Pack now uses my datapack registering system.
- Custom head NBT now uses integers rather than full version number
| Old version | New integer version | |------------------|---------------------| | {latest-version} | REMOVED | | 1.0.0 | 1 | | 1.1.0 | 2 (latest) |
LOAD MORE LOGS
tools/tracking
4835490
119
place-on-head-datapack-edition
Create an account or sign in to comment.
also I was reading the code, and it used a setblock command to setblock a barrel at y-0 and then replace it with bedrock. can you fix this for the end? if you were to use it in the end random bedrock would be everywhere.