Is it possible to detect a combo of inputs?

Started by Grimlock on

Topic category: Help with Minecraft modding (Java Edition)

Joined Jul 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Is it possible to detect a combo of inputs?

What I mean is like the konami code. If you enter up, up, down, down, left, right, left, right, B, A, it could open like a gui or something. Is this possible with custom code. I know skytils did something like this and I wondered if you could recreate that in mcreator.

Joined Oct 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
It is possible, only with…
Fri, 08/18/2023 - 05:41

It is possible, only with custom code since I'm pretty sure mcreator doesn't provide global trigger and key enum for this. 

Basically you'd make two lists: 

  1. Konami code list - that has correct sequence. 
  2. Bufer list - that saves last N key presses (10 for konami code). 

On each key stroke, you'd update the buffer and check the buffer against konami code list and do whatever you want if both lists are equal.