package net.minecraft.network.packet;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import net.minecraft.entity.Entity;
public class Packet39AttachEntity extends Packet
{
public int entityId;
public int vehicleEntityId;
public Packet39AttachEntity() {}
public Packet39AttachEntity(Entity par1Entity, Entity par2Entity)
{
this.entityId = par1Entity.entityId;
this.vehicleEntityId = par2Entity != null ? par2Entity.entityId : -1;
}
/**
* Abstract. Return the size of the packet (not counting the header).
*/
public int getPacketSize()
{
return 8;
}
/**
* Abstract. Reads the raw packet data from the data stream.
*/
public void readPacketData(DataInputStream par1DataInputStream) throws IOException
{
this.entityId = par1DataInputStream.readInt();
this.vehicleEntityId = par1DataInputStream.readInt();
}
/**
* Abstract. Writes the raw packet data to the data stream.
*/
public void writePacketData(DataOutputStream par1DataOutputStream) throws IOException
{
par1DataOutputStream.writeInt(this.entityId);
par1DataOutputStream.writeInt(this.vehicleEntityId);
}
/**
* Passes this Packet on to the NetHandler for processing.
*/
public void processPacket(NetHandler par1NetHandler)
{
par1NetHandler.handleAttachEntity(this);
}
/**
* only false for the abstract Packet class, all real packets return true
*/
public boolean isRealPacket()
{
return true;
}
/**
* eg return packet30entity.entityId == entityId; WARNING : will throw if you compare a packet to a different packet
* class
*/
public boolean containsSameEntityIDAs(Packet par1Packet)
{
Packet39AttachEntity var2 = (Packet39AttachEntity)par1Packet;
return var2.entityId == this.entityId;
}
}