Advertisement
GamingLVScripts

onUpdate

Apr 1st, 2024
276
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.07 KB | None | 0 0
  1. /**
  2.      * Called to update the entity's position/logic.
  3.      */
  4.     public void onUpdate() {
  5.         if (this.worldObj.isBlockLoaded(new BlockPos(this.posX, 0.0D, this.posZ))) {
  6.             new UpdateEvent().publishItself();
  7.             final UpdateMotionEvent updateMotionEvent = new UpdateMotionEvent(UpdateMotionEvent.Type.PRE, this.isCurrentViewEntity()).publishItself();
  8.             if(updateMotionEvent.isCancelled())
  9.                 return;
  10.             super.onUpdate();
  11.             new UpdateMotionEvent(UpdateMotionEvent.Type.MID, updateMotionEvent.isCurrentView()).publishItself();
  12.             if (this.isRiding()) {
  13.                 this.sendQueue.addToSendQueue(new C03PacketPlayer.C05PacketPlayerLook(PlayerHandler.yaw, PlayerHandler.pitch, this.onGround));
  14.                 this.sendQueue.addToSendQueue(new C0CPacketInput(this.moveStrafing, this.moveForward, this.movementInput.jump, this.movementInput.sneak));
  15.             } else {
  16.                 this.onUpdateWalkingPlayer(updateMotionEvent, PlayerHandler.yaw, PlayerHandler.pitch);
  17.             }
  18.         }
  19.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement