mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-14 01:14:18 +00:00
Properly calculate distance in subtick-distances for accuracy
This commit is contained in:
1 parent
49e3e49fd8
commit
11eb112c84
1 file changed
+11
-1
@@ -183,8 +183,18 @@ public abstract class ProjectileBase extends EntityArrow implements IEntityAddit
|
||||
NBTTagCompound tags = returnStack.getTagCompound().getCompoundTag("InfiTool");
|
||||
float speed = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ);
|
||||
|
||||
float distance = speed * this.ticksInAir;
|
||||
speed = Math.max(0, speed-2);
|
||||
|
||||
// absolute distance travelled minus the current tick
|
||||
float distance = speed * (this.ticksInAir-1);
|
||||
// distance travelled in the current tick
|
||||
float dist2 = 0;
|
||||
dist2 += MathHelper.abs((float)movingobjectposition.entityHit.lastTickPosX - (float)this.lastTickPosX);
|
||||
dist2 += MathHelper.abs((float)movingobjectposition.entityHit.lastTickPosY - (float)this.lastTickPosY);
|
||||
dist2 += MathHelper.abs((float)movingobjectposition.entityHit.lastTickPosZ - (float)this.lastTickPosZ);
|
||||
dist2 = MathHelper.sqrt_double(dist2);
|
||||
|
||||
distance += dist2;
|
||||
|
||||
if(!tags.hasKey("BaseAttack"))
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user