Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private boolean flag;
- @SubscribeEvent(priority=EventPriority.HIGHEST)
- public void renderEntityPre(RenderPlayerEvent.Pre e){
- EntityPlayer player=e.getEntityPlayer();
- Entity en=player.getRidingEntity();
- if(en instanceof EntitySquid){
- EntitySquid squid=(EntitySquid)en;
- flag=true;
- OpenGLM.pushMatrix();
- OpenGLM.translate(0, 3/16F, 0);//not sure why this is needed for fixing center of rotation (if you are using translate below)
- //PartialTicksUtil.calculate(prevPos, pos) is equal to prevPos+(pos-prevPos)*partialTicks to smooth out transformation
- //OpenGLM.rotateX,Y,Z https://github.com/LapisSea/Magiology/blob/1.9/src/main/java/com/magiology/util/statics/OpenGLM.java#L129-L146
- OpenGLM.rotateY(-PartialTicksUtil.calculate(squid.prevRenderYawOffset,squid.renderYawOffset));//-\
- OpenGLM.rotateX(-PartialTicksUtil.calculate(squid.prevSquidPitch,squid.squidPitch)+90);//--------===> match squid rotation
- OpenGLM.rotateZ(-PartialTicksUtil.calculate(squid.prevSquidYaw,squid.squidYaw));//---------------/
- //fix gap between riding entity and
- OpenGLM.translate(0, -3/16F, 0);
- }else flag=false;
- }
- @SubscribeEvent(priority=EventPriority.HIGHEST)
- public void renderPlayerPost(RenderPlayerEvent.Post e){
- if(flag){
- OpenGLM.popMatrix();
- }
- }
Add Comment
Please, Sign In to add comment