How do I determine which hopper the user clicked in Minecraft with command blocks?
I'm using Minecraft 1.10, if it helps. I'm making a mini-game where the player needs to rotate hoppers in order to direct items to the correct place (I'm summoning particles under the hoppers to indicate where items currently are). While deciding what the interface should be for the player controls, I realized that I can set the Lock tag on a hopper to prevent the UI from showing up when right-clicked, but it would still increase the stat.hopperInspected scoreboard stat when the player right-clicks it. Perfect! Just right-click a hopper to rotate it...except that there are going to be several (or many) hoppers next to each other, in a chain in fact. So once I know the player has right-click a hopper from the scoreboard, what's the best way to detect which hopper was clicked?
I already have a marker armor stand in each of the hoppers, for the particle indicators, if that helps. I just can't think of a good way. The best I've thought of is "force the player to stand directly under the hopper they're clicking", but that's not easy to enforce and would be problematic if they don't do it. (I guess I could /tp them to force them to look directly upwards, but that's also pretty terrible UI, I think...)
So what's the best way to do this?
Solution 1:
Do you really need to click on hoppers? It would be much easiers to make player interact with invisible entities.
For example, you could have some gear in player's hotbar, that would be equipeed on armor stands as he right-clicks it.
Or you could use other entities like villagers for that. You could even make armor stand wear some gear already, but make it invisible via res. pack.