Advertisement
Guest User

Untitled

a guest
Dec 12th, 2018
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. package net.minecraft.client.venixpll.wings;
  2.  
  3. import net.minecraft.client.model.ModelBase;
  4. import net.minecraft.client.model.ModelRenderer;
  5.  
  6. public class ModelWingBase
  7. extends ModelBase
  8. {
  9. protected static float SCALE = 0.0625F;
  10.  
  11. protected float getWingAngle(boolean isFlying, float maxAngle, int totalTime, int flyingTime, double d)
  12. {
  13. float angle = 0.0F;
  14.  
  15. int flapTime = totalTime;
  16. if (isFlying) {
  17. flapTime = flyingTime;
  18. }
  19. float deltaTime = getAnimationTime(flapTime, d);
  20. if (deltaTime <= 0.5F) {
  21. angle = Sigmoid(-4.0F + deltaTime * 2.0F * 8.0F);
  22. } else {
  23. angle = 1.0F - Sigmoid(-4.0F + (deltaTime * 2.0F - 1.0F) * 8.0F);
  24. }
  25. angle *= maxAngle;
  26.  
  27. return angle;
  28. }
  29.  
  30. protected void setRotation(ModelRenderer model, float x, float y, float z)
  31. {
  32. model.rotateAngleX = x;
  33. model.rotateAngleY = y;
  34. model.rotateAngleZ = z;
  35. }
  36.  
  37. private static float Sigmoid(double value)
  38. {
  39. return 1.0F / (1.0F + (float)Math.exp(-value));
  40. }
  41.  
  42. private float getAnimationTime(int totalTime, double d)
  43. {
  44. float time = (float)((System.currentTimeMillis() + d) % totalTime);
  45. return time / totalTime;
  46. }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement