How to make a shooting speed timer?

Started by AlexelierArtist on

Topic category: Help with modding (Java Edition)

Last seen on 20:01, 8. Dec 2023
Joined Jan 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to make a shooting speed timer?

I want to make The Binding of Isaac mc mod and I just have one problem

I dont want to make it that you need to click every time to shoot but to make it just on holding the key down.
I was thinking to try make a timer that would shoot on every time it ends, but I have no idea how to, and the key bind have only the option "on key pressed"

Does someone know how could I do it?

Last seen on 07:30, 24. Sep 2022
Joined Mar 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Try using nbt numbers
Sun, 09/04/2022 - 07:35

Try using nbt numbers

Last seen on 06:22, 13. Mar 2023
Joined Feb 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Use a keybind/trigger to set…
Sun, 09/04/2022 - 13:12

Use a keybind/trigger to set a logic variable or saved NBT data of some kind to true when pressed, and false when released. On player tick, make another number variable or NBT value of the same type saved to the same thing. Variable can be any kind, NBT data can be on anything

if (logicValue==true) {

        doubleValue=doubleValue+1;

        if (doubleValue==desired wait time){

               doubleValue= 0;

               Call Procedure you wish to call/run desired code here

       }

}

This can be replicated using procedures rather easily, and is one of the best ways to do on on tick loops. For blocks, this kind of tick loop works the best for blocks as blocks can set their tickrate, or even use a random tick rate, giving you a little more control over it. You can also use this to make a random tick rate for things other than blocks by changing this around a little.