LapisSea

Untitled

Jan 7th, 2016
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1.  
  2. import net.minecraft.entity.EntityLivingBase;
  3.  
  4. import com.magiology.mcobjects.entitys.ClientFakePlayer;
  5. import com.magiology.util.utilclasses.UtilM;
  6.  
  7. public class CameraHandeler{
  8.  
  9. private static boolean isActive=false, curentActiveFrame;
  10.  
  11. private static ClientFakePlayer camera;
  12.  
  13.  
  14. public static void setActive(boolean active){
  15. if(isActive&&!active)setCameraToEntity(UtilM.getThePlayer());
  16. isActive=active;
  17. if(isActive)UtilM.getMC().setRenderViewEntity(getCamera());
  18. else UtilM.getMC().setRenderViewEntity(UtilM.getThePlayer());
  19. }
  20.  
  21. public static void setYaw(float yaw){
  22. getCamera().setYaw(yaw);
  23. }
  24.  
  25. public static void setPitch(float pitch){
  26. getCamera().setPitch(pitch);
  27. }
  28.  
  29. public static void setPrevYaw(float yaw){
  30. getCamera().setPrevYaw(yaw);
  31. }
  32.  
  33. public static void setPrevPitch(float pitch){
  34. getCamera().setPrevPitch(pitch);
  35. }
  36.  
  37. public static void setPos(double x, double y, double z){
  38. getCamera().setPos(x, y, z);
  39. }
  40.  
  41. public static void setPrevPos(double x, double y, double z){
  42. getCamera().setPrevPos(x, y, z);
  43. }
  44.  
  45. public static void setCameraToEntity(EntityLivingBase entity){
  46. setYaw(entity.rotationYawHead);
  47. setPitch(entity.rotationPitch);
  48. setPos(entity.posX, entity.posY, entity.posZ);
  49. setPrevYaw(entity.prevRotationYawHead);
  50. setPrevPitch(entity.prevRotationPitch);
  51. setPrevPos(entity.prevPosX, entity.prevPosY, entity.prevPosZ);
  52. }
  53.  
  54. public static ClientFakePlayer getCamera(){
  55. if(camera==null)camera=new ClientFakePlayer();
  56. return camera;
  57. }
  58. }
Add Comment
Please, Sign In to add comment