Get Player Who Used the Keybind

Started by ninjapirate1031 on

Topic category: Help with modding (Java Edition)

Last seen on 17:37, 10. Apr 2020
Joined Feb 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Get Player Who Used the Keybind

I'm working on a feature in which a player will click a button, and it will give them a random potion effect. I've worked out how the random number is generated and the potion effects and such, but it's telling me that I need the Entity dependency. How can I make it so that the potion effect only applies to the player who used the keybind/hit the button?

Last seen on 17:02, 24. Jan 2021
Joined Jan 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Maybe set a global variable…
Fri, 03/27/2020 - 14:35

Maybe set a global variable to set "get display name of provided" on the button-block's right click?

Last seen on 17:37, 10. Apr 2020
Joined Feb 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I'm sorry, I should have…
Fri, 03/27/2020 - 14:41

I'm sorry, I should have been more specific. When I said "button" I meant it as in Keyboard Key. I was trying to use a keybind to activate it (ie: When the player presses "R", it randomly generates and applies one of the potions i have)

Last seen on 17:02, 24. Jan 2021
Joined Jan 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Try setting the global…
Fri, 03/27/2020 - 17:45

Try setting the global variable within the "on key pressed" procedure