content: package net.minecraft.network.play.server;
  
  import lombok.Getter;
  import lombok.Setter;
  import net.minecraft.entity.Entity;
  import net.minecraft.network.Packet;
  import net.minecraft.network.PacketBuffer;
  import net.minecraft.network.play.INetHandlerPlayClient;
  
  import java.io.IOException;
  
  @Getter
  public class S12PacketEntityVelocity implements Packet<INetHandlerPlayClient> {
      private int entityID;
      @Setter
      public int motionX, originX;
      @Setter
      public int motionY, originY;
      @Setter
      public int motionZ, originZ;
  
      @Setter
      boolean modified = false, toggleSprint = false;
  
      public S12PacketEntityVelocity() {
      }
  
      public S12PacketEntityVelocity(Entity entityIn) {
          this(entityIn.getEntityId(), entityIn.motionX, entityIn.motionY, entityIn.motionZ);
      }
  
      public S12PacketEntityVelocity(int entityIDIn, double motionXIn, double motionYIn, double motionZIn) {
          this.entityID = entityIDIn;
          double d0 = 3.9D;
  
          if (motionXIn < -d0) {
              motionXIn = -d0;
          }
  
          if (motionYIn < -d0) {
              motionYIn = -d0;
          }
  
          if (motionZIn < -d0) {
              motionZIn = -d0;
          }
  
          if (motionXIn > d0) {
              motionXIn = d0;
          }
  
          if (motionYIn > d0) {
              motionYIn = d0;
          }
  
          if (motionZIn > d0) {
              motionZIn = d0;
          }
  
          this.originX = this.motionX = (int) (motionXIn * 8000.0D);
          this.originY = this.motionY = (int) (motionYIn * 8000.0D);
          this.originZ = this.motionZ = (int) (motionZIn * 8000.0D);
      }
  
      public void readPacketData(PacketBuffer buf) throws IOException {
          this.entityID = buf.readVarIntFromBuffer();
          this.originX = this.motionX = buf.readShort();
          this.originY = this.motionY = buf.readShort();
          this.originZ = this.motionZ = buf.readShort();
      }
  
      public void writePacketData(PacketBuffer buf) throws IOException {
          buf.writeVarIntToBuffer(this.entityID);
          buf.writeShort(this.motionX);
          buf.writeShort(this.motionY);
          buf.writeShort(this.motionZ);
      }
  
      public void processPacket(INetHandlerPlayClient handler) {
          handler.handleEntityVelocity(this);
      }
  }
  