2025-11-24 22:52:51 +03:00

45 lines
1.2 KiB
Java

/*
* Decompiled with CFR 0.152.
*/
package net.minecraft.network.protocol.common;
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.common.ClientCommonPacketListener;
import net.minecraft.network.protocol.common.CommonPacketTypes;
public class ClientboundPingPacket
implements Packet<ClientCommonPacketListener> {
public static final StreamCodec<FriendlyByteBuf, ClientboundPingPacket> STREAM_CODEC = Packet.codec(ClientboundPingPacket::write, ClientboundPingPacket::new);
private final int id;
public ClientboundPingPacket(int id) {
this.id = id;
}
private ClientboundPingPacket(FriendlyByteBuf input) {
this.id = input.readInt();
}
private void write(FriendlyByteBuf output) {
output.writeInt(this.id);
}
@Override
public PacketType<ClientboundPingPacket> type() {
return CommonPacketTypes.CLIENTBOUND_PING;
}
@Override
public void handle(ClientCommonPacketListener listener) {
listener.handlePing(this);
}
public int getId() {
return this.id;
}
}