I'm wanting (for minecraft 1.12.2 or 18w01a) to have a way, that whenever I mine an ore I get a msg that appears in chat that tells me how many of that ore are in that vein (an alternate thing that would be okay with me would be to make the ores glow), tho I wish to use no mods nor hacks, and this is for a single-player world, can someone help me?
Since you only want ideas, I'll present a possible concept:
Detecting when a block is mined can be done with scoreboards that use statistics like
If you're in 1.13, you could in theory use raycasting to find out which block the player currently mines by permanently checking which blocks he looks at. That would give perfect results, but also create a lot of lag.
Instead, I would just assume that you are standing close to the mined block and therefore restrict it to only a few camera angle areas. Be careful that
rym in 1.12 and
y_rotation in 1.13 work very differently.
Now that you have the block, you should put an armour stand in it. Then you summon one armour stand above, one below, four on the sides. Then you kill off all of them that are in stone, air or just not in the same ore. And you kill off all that are inside another armour stand. Of course you somehow have to differentiate them for that, you could for example use a custom (simplified) ID system for that.
Then you also have to detect when you are done. For that, you should make every armour stand increase a shared score (for example on you) by six before creating the armour stands around. Then you either decrease the score by one for every killed armour stand (for example with
/execute store success) or you compare the result for this summoning round with the one from the last, whatever works best.
If you kill the same amount of armour stands in a round that you summoned, you can stop. The total number of armour stands left now is the number of ores. And they are in the position of the blocks.
You can for example give out the number with a
score tag in the JSON of a
To make the blocks glow, you could use invisible shulkers, but that would have the disadvantage that you can't mine the blocks then. If you want to get really fancy, you can still do it, but offset the shulkers by a very small amount away from the player (eight combinations of xyz +/-).
Alternatively, you can summon a glowing marker armour stand with a block on its face, but then the block will be smaller.
I have also thought about minecarts with blocks in them and a huge offset, but sadly Glowing doesn't work with them.
And of course you have to kill the shulker or armour stand when its block is mined.