When an ore, still liquid, etc. is nearby, there should be a blank sound that plays so that it shows a subtitle. The thing is, though, that I don't know how to detect a block and have command run at its position.
The command below might be of some use for you. It basically has the ability to execute command anywhere through the positioned coordinates then the next set of coordinates detects for the block from the coordinates. If you want to see more examples on how it works check out the Pyramid thread. Now I don't know if there is a way to detect for an array of blocks all I know is how to detect for one.
execute positioned ~ ~ ~ if block ~12 ~1 ~ redstone_block run
When an ore, still liquid, etc. is nearby, there should be a blank sound that plays so that it shows a subtitle. The thing is, though, that I don't know how to detect a block and have command run at its position.
Please help!
You can't detect a block nearby. That only works with entities. Blocks can be detected one by one by testing their coordinates.
I think what you're asking for is the same with 1.12 (and below) raycasting again.
Pretty sure you have to account for every block around you if they are a certain block.
For example
/execute as @p if block ~5 ~5 ~5 diamond_ore run say diamond block nearby!
and repeat
I think this is the right command?
This would be possible but it is a lot of commands, If you were to use raycasting, the game would probably lag and crash because of the huge amount of rays being cast at the same time.
When an ore, still liquid, etc. is nearby, there should be a blank sound that plays so that it shows a subtitle. The thing is, though, that I don't know how to detect a block and have command run at its position.
Please help!
Since this is not possible without writing a huge amount of commands, you can summon an armor stand in some blocks that you want to detect (if there isn't too many of them) and then detect a nearby armor stand.
/execute as <player> at @s if entity @e[type=armor_stand,tag=grass_block,distance=..5] run ...
I think I'll try detecting the blocks one by one. Thanks for the answers! However, if someone finds something better, please let me know. Thanks again!
It's been more than a quarter of a year.
Let me restate it:
When an ore, still liquid, etc. is nearby, there should be a blank sound that plays so that it shows a subtitle. The thing is, though, that I don't know how to detect a block and have command run at its position.
Please help!
The command below might be of some use for you. It basically has the ability to execute command anywhere through the positioned coordinates then the next set of coordinates detects for the block from the coordinates. If you want to see more examples on how it works check out the Pyramid thread. Now I don't know if there is a way to detect for an array of blocks all I know is how to detect for one.
You can't detect a block nearby. That only works with entities. Blocks can be detected one by one by testing their coordinates.
Command block engineer // Developer // #TeamTrees
I think what you're asking for is the same with 1.12 (and below) raycasting again.
Pretty sure you have to account for every block around you if they are a certain block.
For example
and repeat
I think this is the right command?
This would be possible but it is a lot of commands, If you were to use raycasting, the game would probably lag and crash because of the huge amount of rays being cast at the same time.
Since this is not possible without writing a huge amount of commands, you can summon an armor stand in some blocks that you want to detect (if there isn't too many of them) and then detect a nearby armor stand.
Command block engineer // Developer // #TeamTrees
I think I'll try detecting the blocks one by one. Thanks for the answers! However, if someone finds something better, please let me know. Thanks again!