Advertisement
Guest User

Untitled

a guest
Aug 30th, 2016
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.19 KB | None | 0 0
  1.     @SideOnly(Side.CLIENT)
  2.     @SubscribeEvent(priority = EventPriority.HIGHEST)
  3.     public void addRotation(RenderPlayerEvent.Pre event)
  4.     {
  5.         EntityPlayer p = event.getEntityPlayer();
  6.         if(this.isPassenger(p))
  7.         {
  8.             this.playerRotated = true;
  9.             GlStateManager.pushMatrix();
  10.             //Offset to take the rider out of the middle of the mob!
  11.             GlStateManager.translate(0.0F, 0.22F, 0.0F);
  12.             double prevPitch_r = this.squidCap.getPrevRotPitch();
  13.             double pitch_r = this.squidCap.getRotPitch();
  14.             float partialTick = event.getPartialRenderTick();
  15.             double exactPitch_r = prevPitch_r + (pitch_r - prevPitch_r) * partialTick;
  16.             double exactPitch_d = exactPitch_r * 180 / Math.PI;
  17.             double yaw_r = this.squidCap.getRotYaw();
  18.             GlStateManager.rotate((float) (exactPitch_d - 90.0F),   (float) Math.cos(yaw_r), 0.0F, (float) Math.sin(yaw_r));
  19.         }
  20.     }
  21.  
  22.     @SubscribeEvent(priority=EventPriority.LOWEST)
  23.     public void removeRotation(RenderPlayerEvent.Post event)
  24.     {
  25.         if(this.playerRotated)
  26.         {
  27.             GlStateManager.popMatrix();
  28.             this.playerRotated = false;
  29.         }
  30.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement