Jump to content

[1.7.10] Help needed with understanding EntityArrowObject


Recommended Posts

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?

Posted

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.

Posted

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

Posted

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...

×   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.

Announcements



×
×
  • Create New...

Important Information

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