3

I want to make a scale datapack in Minecraft, however to do that I need to know which block is currently being 'scanned'. Assuming there was a /whatblock command, I could then ideally do /execute as @e[tag=Small] store result entity @s HandItems string 1 run whatblock ~ ~ ~

Unfortunately, of course basically none of that works, both because Minecraft seems to hate string datatypes and because the /whatblock command doesn't seem to exist. I was playing with the idea of getting an Enderman to pick up the block, thus making it NBT data, but a. I don't know how to force an Enderman to do that and b. The Enderman would then need to pick up pretty much any block, including obsidian, making them extremely dangerous.

Currently, the only other option I can see is to make a giant list for every single block in Minecraft, then go If block ~ ~ ~ stone then set handitem to stone. If block ~ ~ ~ dirt then set handitem to dirt... etc As you can imagine, for each of the 3172 blocks in the game, I'd need a line of code, which would need to run for every single block in the reference build.

As such, any alternative would be greatly appreciated.

1

1 Answer 1

0

Thanks to hfanatic I was able to figure it out. The first answer is using the /loot give @s mine command to get the block of whatever is dropped. I can then tell it to place the loot in a block with loot replace block 43 -48 26 inventory.0 mine ~ ~-1 ~ minecraft:netherite_pickaxe{Enchantments:[{id:"minecraft:silk_touch",lvl:1}]} This turns it into NBT data inside the chest, which is identified by the numbered coordinates, the block that is added is the ~ ~ ~ coordinates. These can of course be changed to anything required.

Then to get it into an armourstand's hands I do data modify entity @e[tag=dw.Model.PB,limit=1] HandItems[0] set from block 43 -48 26 Items[0] It's important that the items[n] in the /loot and /data commands are the same number, along with both numbered coordinates.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.