-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8537803
commit e75bad1
Showing
2 changed files
with
17 additions
and
3 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
src/main/java/com/mmodding/mmodding_lib/library/client/utils/AnimationUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.mmodding.mmodding_lib.library.client.utils; | ||
|
||
import net.minecraft.entity.LivingEntity; | ||
import net.minecraft.util.math.MathHelper; | ||
import net.minecraft.util.math.Vec3d; | ||
import org.quiltmc.loader.api.minecraft.ClientOnly; | ||
|
||
@ClientOnly | ||
public class AnimationUtils { | ||
|
||
public boolean isMoving(LivingEntity livingEntity, float limbSwingAmount, float motionThreshold) { | ||
Vec3d velocity = livingEntity.getVelocity(); | ||
float averageVelocity = (MathHelper.abs((float) velocity.x) + MathHelper.abs((float) velocity.z)) / 2f; | ||
return averageVelocity >= motionThreshold && limbSwingAmount != 0; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters