Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  yo
Language: C/C++
Code:
package com.vicmatskiv.weaponlib.animation;

import java.util.HashMap;
import java.util.Map;
import net.minecraft.entity.player.EntityPlayer;

public class PlayerRawPitchAnimationManager {
   private Map<EntityPlayer, PlayerRawPitchAnimation> animations = new HashMap();
   private float maxYaw = 0.0F;
   private float maxPitch = 0.0F;
   private long transitionDuration = 2000L;

   public PlayerRawPitchAnimationManager setMaxYaw(float maxYaw) {
      this.maxYaw = maxYaw;
      return this;
   }

   public PlayerRawPitchAnimationManager setMaxPitch(float maxPitch) {
      this.maxPitch = maxPitch;
      return this;
   }

   public PlayerRawPitchAnimationManager setTransitionDuration(long transitionDuration) {
      this.transitionDuration = transitionDuration;
      return this;
   }

   public void update(EntityPlayer player) {
      this.getAnimation(player).update();
   }

   public void reset(EntityPlayer player) {
      this.getAnimation(player).reset();
   }

   private PlayerRawPitchAnimation getAnimation(EntityPlayer player) {
      return (PlayerRawPitchAnimation)this.animations.computeIfAbsent(player, (p) -> {
         return (new PlayerRawPitchAnimation()).setMaxPitch(this.maxPitch).setMaxYaw(this.maxYaw).setPlayer(player).setTransitionDuration(this.transitionDuration);
      });
   }
}

          
          
Comments: