3

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?

  • is there a blockdata command you can use to keep reseting the stat.hopperInspected. when you click a hopper the score goes up andthen resets. Im not good at commands. hope this helped – Haroun Mohamed-Fakier Jun 13 '16 at 9:55
  • stat.hopperInspected already increases on its own when you click a hopper. But as a scoreboard objective type, it can only be applied to entities. There's no way to store that in a block, and blocks don't keep track of that information. – IceMetalPunk Jun 14 '16 at 6:10
  • Just something that comes to mind: Is the player standing on one specific spot? If so, you could use the rotation of the player model to determine which hopper the player is pointing at (if this information can be retrieved via commands). – RimaNari Jun 18 '16 at 14:58
  • No, the player needs to be able to reach all the hoppers in the puzzle, so they have to be able to move around. – IceMetalPunk Jun 21 '16 at 3:52
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.

  • The UI here is just to let the user choose which hopper to rotate. So there needs to be some connection between what they click and which hopper rotates. I've tried making the armor stands in the hoppers non-invisible and letting the user equip something to them, which kind of works, but unfortunately, the hitbox of an armor stand is inconsistent depending on what angle you click it from (i.e. half the time, you end up not being able to equip anything if you're facing the wrong way). How would I get this to work with villagers? – IceMetalPunk Jun 17 '16 at 17:59

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.