59 lines
1.7 KiB
Java
59 lines
1.7 KiB
Java
/*
|
|
* Decompiled with CFR 0.152.
|
|
*/
|
|
package net.minecraft.network.protocol.game;
|
|
|
|
import net.minecraft.network.FriendlyByteBuf;
|
|
import net.minecraft.network.codec.StreamCodec;
|
|
import net.minecraft.network.protocol.Packet;
|
|
import net.minecraft.network.protocol.PacketType;
|
|
import net.minecraft.network.protocol.game.ClientGamePacketListener;
|
|
import net.minecraft.network.protocol.game.GamePacketTypes;
|
|
import net.minecraft.world.entity.Entity;
|
|
import net.minecraft.world.phys.Vec3;
|
|
|
|
public class ClientboundSetEntityMotionPacket
|
|
implements Packet<ClientGamePacketListener> {
|
|
public static final StreamCodec<FriendlyByteBuf, ClientboundSetEntityMotionPacket> STREAM_CODEC = Packet.codec(ClientboundSetEntityMotionPacket::write, ClientboundSetEntityMotionPacket::new);
|
|
private final int id;
|
|
private final Vec3 movement;
|
|
|
|
public ClientboundSetEntityMotionPacket(Entity entity) {
|
|
this(entity.getId(), entity.getDeltaMovement());
|
|
}
|
|
|
|
public ClientboundSetEntityMotionPacket(int id, Vec3 movement) {
|
|
this.id = id;
|
|
this.movement = movement;
|
|
}
|
|
|
|
private ClientboundSetEntityMotionPacket(FriendlyByteBuf input) {
|
|
this.id = input.readVarInt();
|
|
this.movement = input.readLpVec3();
|
|
}
|
|
|
|
private void write(FriendlyByteBuf output) {
|
|
output.writeVarInt(this.id);
|
|
output.writeLpVec3(this.movement);
|
|
}
|
|
|
|
@Override
|
|
public PacketType<ClientboundSetEntityMotionPacket> type() {
|
|
return GamePacketTypes.CLIENTBOUND_SET_ENTITY_MOTION;
|
|
}
|
|
|
|
@Override
|
|
public void handle(ClientGamePacketListener listener) {
|
|
listener.handleSetEntityMotion(this);
|
|
}
|
|
|
|
public int getId() {
|
|
return this.id;
|
|
}
|
|
|
|
public Vec3 getMovement() {
|
|
return this.movement;
|
|
}
|
|
}
|
|
|