Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

Hey,

I am making a class which is extension for ranged weapons classes in my mod.

The main reason why I want to do that is better and faster weapons coding.

Now I am trying to change a reloading time off weapons. Just simply code the number double number of seconds to reload.

I stucked on creating new EntityArrow object when the player stops using item.

 

EntityArrow entityarrow = new EntityArrow(par2World, par3EntityPlayer, (float) (f * 2.0F * 4/3));

I dont know what is the third parameter. In my forge dev build there isnt any desc of that method and its parameters.

It could be a start speed of an arrow or sth like this but I am not sure. What could be the units if so. Meters per second wheter other?

  • Author

I did it but it didnt help.

 

float f = (float)j / 20.0F;
            f = (f * f + f * 2.0F) / 3.0F;

            if ((double)f < 0.1D)
            {
                return;
            }

            if (f > 1.0F)
            {
                f = 1.0F;
            }

            EntityArrow entityarrow = new EntityArrow(p_77615_2_, p_77615_3_, f * 2.0F);

Float f seems to be an amount of seconds of bow pulling(int j is a tick amount)

I dont understand that code:  f = (f * f + f * 2.0F) / 3.0F;

Than there are 2 ifs. First looks if the f isnt too small, second isnt too big. So it probably could be a 0-1 relation of max bow pulling.

 

I can add that changing 3rd parameter changes speed of arrows. Problem is what are the units.

Hi

 

Based on the code in setThrowableHeading(), it appears to be the initial speed of the arrow, probably in metres per tick.

 

-TGG

 

Well then - try it and see :)

 

Put a system.out.println({position}) in the arrow's tick update (don't forget that it will run on both client and server), and you will be able to calculate the distance per tick very easily.

 

-TGG

  • Author

Greate idea. I will try and reply.

 

I was wrong. That par3 is strange.

If I put there 2F speed seems to be 4m/tick

When 4F it seems to be from 4 to 6.

 

Can sb tries to get know what are those par3 and how to set correctly speed??

Mayby I have too much lags and speed isnt corectly shown in console.

 

@Edit

Ok, now I am 100% sure that par3 is speed :)

par3 is preaty strange argument. The unit of it is meter per tick, but we must / our speed by 1.5 to make it correct in the balistic code.

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.