Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @SideOnly(Side.CLIENT)
- @SubscribeEvent(priority = EventPriority.HIGHEST)
- public void addRotation(RenderPlayerEvent.Pre event)
- {
- EntityPlayer p = event.getEntityPlayer();
- if(this.isPassenger(p))
- {
- this.playerRotated = true;
- GlStateManager.pushMatrix();
- //Offset to take the rider out of the middle of the mob!
- GlStateManager.translate(0.0F, 0.22F, 0.0F);
- double prevPitch_r = this.squidCap.getPrevRotPitch();
- double pitch_r = this.squidCap.getRotPitch();
- float partialTick = event.getPartialRenderTick();
- double exactPitch_r = prevPitch_r + (pitch_r - prevPitch_r) * partialTick;
- double exactPitch_d = exactPitch_r * 180 / Math.PI;
- double yaw_r = this.squidCap.getRotYaw();
- GlStateManager.rotate((float) (exactPitch_d - 90.0F), (float) Math.cos(yaw_r), 0.0F, (float) Math.sin(yaw_r));
- }
- }
- @SubscribeEvent(priority=EventPriority.LOWEST)
- public void removeRotation(RenderPlayerEvent.Post event)
- {
- if(this.playerRotated)
- {
- GlStateManager.popMatrix();
- this.playerRotated = false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement