Advertisement
GamingLVScripts

updateRidden

Apr 1st, 2024
446
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.31 KB | None | 0 0
  1. /**
  2.      * Handles updating while being ridden by an entity
  3.      */
  4.     public void updateRidden() {
  5.         if (!this.worldObj.isRemote && this.isSneaking()) {
  6.             this.mountEntity((Entity) null);
  7.             this.setSneaking(false);
  8.         } else {
  9.             double d0 = this.posX;
  10.             double d1 = this.posY;
  11.             double d2 = this.posZ;
  12.             float yaw = this.rotationYaw;
  13.             float pitch = this.rotationPitch;
  14.             if(this == Minecraft.getMinecraft().thePlayer) {
  15.                 yaw = PlayerHandler.yaw;
  16.                 pitch = PlayerHandler.pitch;
  17.             }
  18.             float f = yaw;
  19.             float f1 = pitch;
  20.             super.updateRidden();
  21.             this.prevCameraYaw = this.cameraYaw;
  22.             this.cameraYaw = 0.0F;
  23.             this.addMountedMovementStat(this.posX - d0, this.posY - d1, this.posZ - d2);
  24.  
  25.             if (this.ridingEntity instanceof EntityPig) {
  26.                 this.rotationPitch = f1;
  27.                 this.rotationYaw = f;
  28.                 if(this == Minecraft.getMinecraft().thePlayer) {
  29.                     PlayerHandler.yaw = f;
  30.                     PlayerHandler.pitch = f1;
  31.                 }
  32.                 this.renderYawOffset = ((EntityPig) this.ridingEntity).renderYawOffset;
  33.             }
  34.         }
  35.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement