Arqade Asked by D3T0NA on December 3, 2020
The idea is to replace the head slot of any armor stand with the tag Cookie if it has no player_head equipped (testing for item in inventory), it is basically for a infinite cookie machine.
But the command replaces the head item nonstop even when the armor stand has the player skull on.
It works, but the sound is annoying and i am afraid it is going to lag if i create multiple of those.
execute as @e[tag=Cookie] unless entity @s[nbt={Inventory:[{id:"minecraft:player_head"}]}] run replaceitem entity @s armor.head minecraft:player_head{display:{Name:"{"text":"Cookie"}"},SkullOwner:{Id:[I;-2013434884,1726368701,-2008161991,474717876],Properties:{textures:[{Value:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMmEzOWJiMjIxZWRmMTM3NjdhODBkNTU2MTJlOGI0NTk3ZjI2Y2NhYjdjOWQ0NWM4MDQwMGQ2Yjg1MDgzYTZkZSJ9fX0="}]}}} 1
Armor stands don't have an inventory like players do. They have ArmorItems and HandItems. So the selector should look like this: @s[nbt={ArmorItems:[{},{},{},{id:"minecraft:player_head"}]}]
.
Full command:
/execute as @e[tag=Cookie] unless entity @s[nbt={ArmorItems:[{},{},{},{id:"minecraft:player_head"}]}] run replaceitem entity @s armor.head minecraft:player_head{display:{Name:"{"text":"Cookie"}"},SkullOwner:{Id:[I;-2013434884,1726368701,-2008161991,474717876],Properties:{textures:[{Value:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMmEzOWJiMjIxZWRmMTM3NjdhODBkNTU2MTJlOGI0NTk3ZjI2Y2NhYjdjOWQ0NWM4MDQwMGQ2Yjg1MDgzYTZkZSJ9fX0="}]}}}
Correct answer by MegaCrafter10 on December 3, 2020
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP