Arqade Asked on April 23, 2021
I’m trying to make a camouflage skill and I want to summon two falling block entities on the player to make it look like they’re just two blocks standing there instead of a player. I know how to summon falling blocks that look like a specific block, but I want to know if it’s possible to summon a block equal to the block the player is standing on.
I know that the tile ID of falling blocks is stored in NBT, so this boils down to the fundamental issue:
How do you get an NBT string containing the namespaced ID of a block at a certain position, and write it to the falling blocks’ NBT data?
This question boils down to the fundamental issue of transforming the block ID at a certain position to an NBT string. There is a clever workaround to do this:
inBlockState.Name
NBT tag which is the block the arrow is in.Prerequisites:
/forceload
command.Commands:
clone <x> <y> <z> <x> <y> <z> -30000000 0 1604
summon arrow -30000000 1 1604 {Tags:["blockTest"]}
schedule function ...
The function targeted by /schedule
should contain the following command:
data get entity @e[type=minecraft:arrow,tag=blockTest] inBlockState.Name
kill @e[type=minecraft:arrow,tag=blockTest]
In your case, you want to copy this data to a falling block's tile name, so instead of the /data get
command above, use this one instead:
data modify entity @e[type=minecraft:falling_block,tag=camouflage] BlockState.Name set from entity @e[type=minecraft:arrow,tag=blockTest] inBlockState.Name
Answered by ExpertCoder14 on April 23, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP