package net.minecraft.network.protocol.game;

import net.minecraft.network.PacketListener;
import java.io.IOException;
import net.minecraft.network.FriendlyByteBuf;
import javax.annotation.Nullable;
import net.minecraft.world.entity.Entity;
import net.minecraft.network.protocol.Packet;

public class ClientboundSetEntityLinkPacket implements Packet<ClientGamePacketListener> {
    private int sourceId;
    private int destId;
    
    public ClientboundSetEntityLinkPacket() {
    }
    
    public ClientboundSetEntityLinkPacket(final Entity akq1, @Nullable final Entity akq2) {
        this.sourceId = akq1.getId();
        this.destId = ((akq2 != null) ? akq2.getId() : 0);
    }
    
    @Override
    public void read(final FriendlyByteBuf kv) throws IOException {
        this.sourceId = kv.readInt();
        this.destId = kv.readInt();
    }
    
    @Override
    public void write(final FriendlyByteBuf kv) throws IOException {
        kv.writeInt(this.sourceId);
        kv.writeInt(this.destId);
    }
    
    @Override
    public void handle(final ClientGamePacketListener lw) {
        lw.handleEntityLinkPacket(this);
    }
    
    public int getSourceId() {
        return this.sourceId;
    }
    
    public int getDestId() {
        return this.destId;
    }
}
