1

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?

  • 1. Have you tried anything on your own? 2. Is it really worth it to do that? It is a medium sized project for something that doesn't seem too useful. 3. Do you count commands as "hacks"? – Fabian Röling Jan 7 '18 at 11:00
  • 1
    @Fabian Commands are not hacks, hacks is like "Aristois" (a hacked client), and functions are not mods, mods are like "Tekkit" (a mod pack), and I don't rly know where to begin, and have tried a search, but nothing seems to help. – DeJeL Jan 8 '18 at 2:27
  • Since your goal is pretty specific, there isn't a pre-made solution available. So what you have to research is how to use Minecraft commands and then you try to create your own solution. – Fabian Röling Jan 8 '18 at 7:14
  • 1
    In such a case recursion is your friend, but doing that with commands.. ouch. Try to have a look at functions instead. – dly Jan 8 '18 at 9:21
  • 1
    I also have quite a lot to do recently and in the next months, but I wanted to try it afterwards anyway. – Fabian Röling Oct 5 '18 at 6:16
1

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 stat.mineBlock.minecraft.coal_ore.

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 rx, rxm, ry and rym in 1.12 and x_rotation 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 /tellraw command.

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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