Is it possible to make this work for all items without using a million commands?
Create an account or sign in to comment.
5
yes, it's possible with just one command block.... always running command block and it is written in just one line so.... the answer is yes.
help :::: watch yt video i ain expert
help :::: watch yt video i ain expert
If I didn't make a mistake this should work for all items (assuming they don't have a special display setting:
you run a function in a loop from
execute as @e[type=item,nbt={OnGround:1b,Thrower:{}}] at @s run function ...
and in the function you do this:
summon armor_stand ~ ~-1.6 ~-0.5 {ArmorItems:[{id:stone},{},{},{}],NoGravity:1,Pose:{Head:[90.0f,0.0f,0.0f]}}
data modify entity @e[type=armor_stand,distance=..2,sort=nearest,limit=1] ArmorItems[3] set from entity @s Item
kill @s
(summons armorstand, copies item data to head slot, kills item)
you should be able to do a similar thing to get the item back (summon dummy item, copy ArmorItems[3] data to Item data of the dummy item, kill armorstand)
Edit: changed distance=..1 to distance=..2
you run a function in a loop from
execute as @e[type=item,nbt={OnGround:1b,Thrower:{}}] at @s run function ...
and in the function you do this:
summon armor_stand ~ ~-1.6 ~-0.5 {ArmorItems:[{id:stone},{},{},{}],NoGravity:1,Pose:{Head:[90.0f,0.0f,0.0f]}}
data modify entity @e[type=armor_stand,distance=..2,sort=nearest,limit=1] ArmorItems[3] set from entity @s Item
kill @s
(summons armorstand, copies item data to head slot, kills item)
you should be able to do a similar thing to get the item back (summon dummy item, copy ArmorItems[3] data to Item data of the dummy item, kill armorstand)
Edit: changed distance=..1 to distance=..2
can't seem to get it to work
these are my original commands:
/execute as @e[nbt={Item:{id:"minecraft:apple"},OnGround:1b}] at @s run summon armor_stand ~ ~-1.7 ~-1 {Invisible:1b,NoGravity:1b,ArmorItems:[{},{},{},{id:"apple",Count:1b}],HandItems:[{},{}],CustomName:"{\"text\":\"item\"}",DisabledSlots:2039583,Pose:{Head:[90f,0f,0f]}}
/execute as @e[nbt={Item:{id:"minecraft:apple"},OnGround:1b}] run kill @s
/execute as @e[name=item] at @s if entity @a[distance=..2,scores={shift=10..}] run give @a[distance=..2,limit=1,scores={shift=10..}] apple
/execute as @e[name=item] at @s if entity @a[distance=..2,scores={shift=10..}] run kill @s
if you don't mind could you fix them?
and could you also try to make it work for the item count
if you don't thanks anyway
these are my original commands:
/execute as @e[nbt={Item:{id:"minecraft:apple"},OnGround:1b}] at @s run summon armor_stand ~ ~-1.7 ~-1 {Invisible:1b,NoGravity:1b,ArmorItems:[{},{},{},{id:"apple",Count:1b}],HandItems:[{},{}],CustomName:"{\"text\":\"item\"}",DisabledSlots:2039583,Pose:{Head:[90f,0f,0f]}}
/execute as @e[nbt={Item:{id:"minecraft:apple"},OnGround:1b}] run kill @s
/execute as @e[name=item] at @s if entity @a[distance=..2,scores={shift=10..}] run give @a[distance=..2,limit=1,scores={shift=10..}] apple
/execute as @e[name=item] at @s if entity @a[distance=..2,scores={shift=10..}] run kill @s
if you don't mind could you fix them?
and could you also try to make it work for the item count
if you don't thanks anyway
I just noticed I made the distance too short in my second command
increase that to ..2 or ..3 and it should work
increase that to ..2 or ..3 and it should work
and to get the item back you do this in a loop:
execute at @a[scores={shift=10..}] as @e[distance=..2,type=armor_stand] run function ...
and in the function you do this:
summon item ~ ~ ~ {Item:{id:"minecraft:stone"}}
data modify entity @e[type=item,distance=..2,sort=nearest,limit=1] Item set from entity @s ArmorItems[3]
kill @s
execute at @a[scores={shift=10..}] as @e[distance=..2,type=armor_stand] run function ...
and in the function you do this:
summon item ~ ~ ~ {Item:{id:"minecraft:stone"}}
data modify entity @e[type=item,distance=..2,sort=nearest,limit=1] Item set from entity @s ArmorItems[3]
kill @s