Jump to content

[solved][1.16.5]How to make arrow faster but not incrase its damage?


Recommended Posts

Posted (edited)

Hello, I have made enchantment that accelerates arrow fired by crossbow, but not only this increases speed, this also increases damage, I want it to have the same damage as before, how can i make damage the same?
What i'm doing is when firing arrow, detect it using EntityJoinWorld event and changing its velocity

if(enchants.containsKey(TCombatEnchants.SNIPE.get())){
	double damage = abstractArrowEntity.getBaseDamage();
	Vector3d vector3d1 = shooter.getUpVector(1.0F); 
	Quaternion quaternion = new Quaternion(new Vector3f(vector3d1), 0, true);
	Vector3d vector3d = shooter.getViewVector(1.0F);
	Vector3f vector3f = new Vector3f(vector3d);
	vector3f.transform(quaternion);
	Vector3d originalVector = abstractArrowEntity.getDeltaMovement();
	double length = originalVector.length() * 10;
	abstractArrowEntity.setDeltaMovement(vector3f.x()*length, vector3f.y()*length, vector3f.z()*length);
	abstractArrowEntity.hurtMarked = true;
	abstractArrowEntity.setBaseDamage(damage);
}

 

Edit:I have solved it by saving length of original velocity and setting damage when it hit entity to its base damage multiplied by saved length

Edited by tmvkrpxl0
solved
Posted (edited)
28 minutes ago, tmvkrpxl0 said:

how can i make damage the same?

I think that's not possible because the damage from the arrow depends on the arrow velocity
that mean if you increase the speed of the arrow, the damage is also increased

 

Edit: check out the method onEntityHit in the AbstractArrowEntity class for more information

Edited by Luis_ST
  • tmvkrpxl0 changed the title to [solved][1.16.5]How to make arrow faster but not incrase its damage?

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.