Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package net.minecraft.client.venixpll.wings;
- import net.minecraft.client.model.ModelBase;
- import net.minecraft.client.model.ModelRenderer;
- public class ModelWingBase
- extends ModelBase
- {
- protected static float SCALE = 0.0625F;
- protected float getWingAngle(boolean isFlying, float maxAngle, int totalTime, int flyingTime, double d)
- {
- float angle = 0.0F;
- int flapTime = totalTime;
- if (isFlying) {
- flapTime = flyingTime;
- }
- float deltaTime = getAnimationTime(flapTime, d);
- if (deltaTime <= 0.5F) {
- angle = Sigmoid(-4.0F + deltaTime * 2.0F * 8.0F);
- } else {
- angle = 1.0F - Sigmoid(-4.0F + (deltaTime * 2.0F - 1.0F) * 8.0F);
- }
- angle *= maxAngle;
- return angle;
- }
- protected void setRotation(ModelRenderer model, float x, float y, float z)
- {
- model.rotateAngleX = x;
- model.rotateAngleY = y;
- model.rotateAngleZ = z;
- }
- private static float Sigmoid(double value)
- {
- return 1.0F / (1.0F + (float)Math.exp(-value));
- }
- private float getAnimationTime(int totalTime, double d)
- {
- float time = (float)((System.currentTimeMillis() + d) % totalTime);
- return time / totalTime;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement