Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.16.5]How to make an auto-gun with certain firing-rate?


USS_Shenzhou
 Share

Recommended Posts

Hi

I am trying to make a gun with a firing-rate of about 800 bullet/min.

The main question is I do not know how to control the time gap between two shooting(should be 1.25ms). Ticks should be the first choice for counting time  in Minecraft, but using ticks seems impossible: 1 tick 1 shoot is too fast(1200 bullet/min), 2 tick 1 shoot is too slow(600 bullet/min).

Any help is highly appreciated !😃

Edited by USS_Shenzhou
Link to comment
Share on other sites

1 tick = 1 shot would mean you have 20 shots per second, not 1200. Minecraft runs at 20 ticks per second.

If you want 800 shots per second that means you need 800 / 20 = 40 shots per tick. To make it seem like the shots are not all at the same time, you have to basically "spread them out" by applying an offset in position to the bullet.

 

However I'll advise you that I don't think Minecraft's engine can handle this very well.

Link to comment
Share on other sites

22 minutes ago, diesieben07 said:

1 tick = 1 shot would mean you have 20 shots per second, not 1200. Minecraft runs at 20 ticks per second.

If you want 800 shots per second that means you need 800 / 20 = 40 shots per tick. To make it seem like the shots are not all at the same time, you have to basically "spread them out" by applying an offset in position to the bullet.

 

However I'll advise you that I don't think Minecraft's engine can handle this very well.

Oh I made a stupid mistake.🤣It should be 800 bullet/min, not per sec. I'm so sorry!

Link to comment
Share on other sites

Okay, so 800 bullets/min. So that's 800/60/20 = 2/3 bullets per tick. In other words you need to fire a bullet 2 out of every 3 ticks.

Increment a number in your gun entity / tile entity every tick and do a modulo division (tickCount % 3). If that's 1 or 2 you fire, if it's 0 you don't. You could also use World#getGameTime instead of your own incrementing number.

One downside of this that the firing pattern won't quite be uniform (no idea if that will be noticeable).

Link to comment
Share on other sites

I have considered the 110110110 mode, and it's a disaster for controlling recoil force...🤣Is there any other possible way avoiding using the 1-sec-20-tick thing, additionally the firing rate can be more flexible, such as 850 bullet/min of another gun? (Although almost whole minecraft world is based on the tick system...)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Hello There! In the 73rd episode of Bed Wars we get into a lobby with a guy who had a cool name and for some reason Ben is very impressed with the name and thus the title!  
    • I have been trying to install forge, but I can't even get the installer to run. I'm really not sure what the issue is, first let me make sure I am even using the installer right, I downloaded the forge installer matching my minecraft version (1.19.2), if I double click the .jar from the download then I see a flash of a black window that immediately disappears. If I use a command prompt, I receive the following output: C:\Users\austi> java -jar forge-1.19.2-43.0.19-installer.jar Error: Unable to access jarfile forge-1.19.2-43.0.19-installer.jar   I feel like this is more likely a java issue than a forge issue but I was hoping that people here might be able to help. I've tried a couple versions of java, at first I was using 8 I believe because all of the install guides for forge were a bit older so they linked to the java website rather than oracle. I tried version 18 from the oracle site and received the same result from command prompt. It is also entirely possible that I am doing something else wrong that is blatantly obvious to everyone else.
    • Here is my configuration: % java -version java version "18.0.2" 2022-07-19 Java(TM) SE Runtime Environment (build 18.0.2+9-61) Java HotSpot(TM) 64-Bit Server VM (build 18.0.2+9-61, mixed mode, sharing) forge-1.19-41.1.0-mdk on macOS Monterey 12.5 I ran the command: ./gradlew genEclipseRuns and was hoping it will generate the Eclipse project files for me. The run log is at https://gist.github.com/arun-gupta/06b983a6976b4c0a0f510d0dc225ddd3 and the generated directory structure is at https://gist.github.com/arun-gupta/3f5bfc70ec5d3d903b0f97d42840abda. In previous versions (1.12-ish), it used to generate an eclipse directory but 1.19 does not seem to have it. I tried opening the top-level forge directory but Eclipse does not recognize it as a project as well. How do I open this project in Eclipse now?  
    • I didn't put in credentials, I used it only for testing installing forge. But still the problem mentioned above.
    • I am trying to use Forge 1.18.2, I have checked my firewall, redownloaded Forge, deleted the fml.toml file (which keeps reappearing) and looked at countless help pages. I am just trying to download and use forge so that I can play with my friends and it will not download. It tells me there may be an issue with the Java runtime config and that the exit code is one, and I have copied the exit code.   
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.