Advertisement
Guest User

Untitled

a guest
Aug 16th, 2016
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. @SubscribeEvent
  2. public void addRotation(RenderPlayerEvent.Pre event)
  3. {
  4. EntityPlayer p = event.getEntityPlayer();
  5. if(this.isPassenger(p))
  6. {
  7. double visualPitch = this.capab.getRotPitch() * 180 / Math.PI;
  8. double visualYaw = this.capab.getRotYaw() * 180 / Math.PI;
  9. GlStateManager.pushMatrix();
  10. GlStateManager.rotate((float) (180.0F - visualYaw) / 2, 0.0F, 1.0F, 0.0F);
  11. GlStateManager.rotate((float) (visualPitch - 90.0F) / 2, -1.0F, 0.0F, 0.0F);
  12. }
  13. }
  14.  
  15. @SubscribeEvent
  16. public void removeRotation(RenderPlayerEvent.Post event)
  17. {
  18. if(this.isPassenger(event.getEntityPlayer()))
  19. {
  20. GlStateManager.popMatrix();
  21. }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement