3

How do I ensure a player always has a specific player head equipped?

Lampe2020's Avatar Lampe20203/30/23 2:18 pm
3 emeralds 173 4
4/5/2023 3:49 pm
axe309's Avatar axe309
I am creating a small 1.19.4 adventure map and want the player to always wear a player head with specific NBT tags.
My problem is that curse of binding doesn't work in creative but I set the player in creative mode after completion of the map to allow him/her to explore the hidden features of said map more easily.
I came up with the idea to simply repeatedly replace the player's armor.head slot contents with the player head but that gives a perma-noise which is disgusting. I then tried to check for that specific head in the player's armor.head but the check either returned true all the time or false all the time, resulting in the command either creating the perma-noise or not doing anything at all.

So the question is: how can I check for a specific player head in the nearest player's armor.head and if it's not any player head or no player head at all replace the armor.head with that specific head?
Posted by Lampe2020's Avatar
Lampe2020
Level 6 : Apprentice Collective
2

Create an account or sign in to comment.

4

axe309
04/05/2023 3:49 pm
Level 18 : Journeyman Warrior
axe309's Avatar
put this in an always active repeating command block, it shouldnt have a perma noise, i checked.
item replace entity @a armor.head with minecraft:player_head{NBTDATAHERE}
1
Luke_Sky_Walker
04/05/2023 2:26 pm
Level 36 : Artisan Mlem Mlem Bat
Luke_Sky_Walker's Avatar
The only solution to this kind of issue would be by using command blocks. Using command blocks would actually be your best bet as to make this kinda thing more effective. By using an '/execute if entity @p' command on repeat and always active, you can constantly check the slot of a player's head. You could then add another command block attached to that which is conditional. If the player's head slot is air (Which you check for in the first command block) then the conditional command block can run and change the player's helmet slot to a NBT head (I would also recommend clearing the player's inventory after changing the slot to prevent the player from getting infinite heads).
1
Oslypsis
03/30/2023 2:37 pm
Level 64 : High Grandmaster Pixel Painter
Oslypsis's Avatar
Maybe put hoppers underneath them in a closed chamber. Then with a button and dispenser, have them dispense the head onto themselves by standing in front of the dispenser when pressing the button. If the player has a helmet on, the head will just drop to the floor and get picked up (I think), so they'll need to take off the helmet and press the dispense button again. As long as the head (that's renamed) doesn't go through a hopper identification system, the button press will also open the door. Idk how you make sure they don't keep the head when they leave though.
1
Lampe2020
04/01/2023 11:17 am
Level 6 : Apprentice Collective
Lampe2020's Avatar
With this solution the player can just take it off in creative (I set the player to creative after him/her completing the world) and get out. I want to do it with command blocks so it checks every tick if the player wears that specific head and if he/she doesn't replace whatever is in the head slot with the player head.
1
Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome