How do I code the ability to fly for set amount of time after right-clicking an item?

Started by Falconier16 on

Topic category: Help with modding (Java Edition)

Last seen on 00:18, 18. May 2020
Joined Apr 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How do I code the ability to fly for set amount of time after right-clicking an item?
Thu, 04/30/2020 - 19:14 (edited)

Hello,

I have an item that when I right click the air with it, I would like to be able to fly for 200 ticks, as well as gain speed boost. I have been able to code this so far. The problem is even after the 200 ticks are over, I can still fly in creative. I have tried "if" statements and "while" loops, however I cannot seem to figure this out.

Any help is appreciated!

Edited by Falconier16 on Thu, 04/30/2020 - 19:14
Last seen on 03:10, 19. Feb 2022
Joined Jun 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
nbt tags and if statements.
Thu, 04/30/2020 - 08:55

nbt tags and if statements.

Last seen on 00:18, 18. May 2020
Joined Apr 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I tried using NBT logic tags…
Fri, 05/01/2020 - 03:47

I tried using NBT logic tags to no avail; the attached image shows the final try before I gave up (this one crashed the game). I was trying to have the flying be enabled while the speed potion was active.

Attempted use of NBT Tags