Minecraft Data Packs / Cosmetic

Place on Head [Datapack Edition]

  • check_circle Functions
  • 4,197 views, 2 today
  • 149 downloads, 0 today
  • 18
  • 13
  • 5
legopitstop's Avatar legopitstop
Level 76 : Legendary Programmer
267

Place on Head [​Datapack Edition]

Legopitstop

Place on Head  [Datapack Edition] Minecraft Data Pack Place on Head  [Datapack Edition] Minecraft Data Pack Place on Head  [Datapack Edition] Minecraft Data Pack

This 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.

Senior Team

Commands


Swap the item that you are holding to place it on your head.
/trigger headtested on 1.17 snapshot 20w46a
should 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)
{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_identifier

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)
{head:{Version:[1.1.0],Type:"custom_name",Name:'{"text":"Custom Name Text","color":"aqua"}'}}Swapped head item with Custom Name Text

Type:"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 Text

EXAMPLE 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



Buy Me a Coffee at ko-fi.com www.patreon.com
CreditLegopitstop
CompatibilityMinecraft 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

Create an account or sign in to comment.

1
09/10/2021 6:17 am
Level 1 : New Miner
cheemistry
cheemistry's Avatar
does this replace the helmet slot, like if i wear the hat can i not wear a helmet
1
09/13/2021 12:17 pm
Level 76 : Legendary Programmer
legopitstop
legopitstop's Avatar
yes, this is just a way to place any item in your head slot (bc some items you cannot place the item directly in the slot, you can only use a command)
1
01/06/2021 6:27 pmhistory
Level 1 : New Miner
User3369631G
User3369631G's Avatar
does this work on 1.16.4? thank you!
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.
1
01/06/2021 9:33 pm
Level 76 : Legendary Programmer
legopitstop
legopitstop's Avatar
This is ONLY possible through the new /item command in 1.17 snapshots that enables it so you can copy the selected item and paste it in the head slot. I think I have a way to fix the bedrock issue.
1
11/13/2020 4:14 pm
Level 1 : New Miner
realCoreZif
realCoreZif's Avatar
finally I can be the space man
Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome