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 aom1, @Nullable final Entity aom2) {
        this.sourceId = aom1.getId();
        this.destId = ((aom2 != null) ? aom2.getId() : 0);
    }
    
    @Override
    public void read(final FriendlyByteBuf mg) throws IOException {
        this.sourceId = mg.readInt();
        this.destId = mg.readInt();
    }
    
    @Override
    public void write(final FriendlyByteBuf mg) throws IOException {
        mg.writeInt(this.sourceId);
        mg.writeInt(this.destId);
    }
    
    @Override
    public void handle(final ClientGamePacketListener nl) {
        nl.handleEntityLinkPacket(this);
    }
    
    public int getSourceId() {
        return this.sourceId;
    }
    
    public int getDestId() {
        return this.destId;
    }
}
