001 package net.minecraft.network.packet;
002
003 import java.io.DataInputStream;
004 import java.io.DataOutputStream;
005 import java.io.IOException;
006 import net.minecraft.potion.PotionEffect;
007
008 public class Packet42RemoveEntityEffect extends Packet
009 {
010 /** The ID of the entity which an effect is being removed from. */
011 public int entityId;
012
013 /** The ID of the effect which is being removed from an entity. */
014 public byte effectId;
015
016 public Packet42RemoveEntityEffect() {}
017
018 public Packet42RemoveEntityEffect(int par1, PotionEffect par2PotionEffect)
019 {
020 this.entityId = par1;
021 this.effectId = (byte)(par2PotionEffect.getPotionID() & 255);
022 }
023
024 /**
025 * Abstract. Reads the raw packet data from the data stream.
026 */
027 public void readPacketData(DataInputStream par1DataInputStream) throws IOException
028 {
029 this.entityId = par1DataInputStream.readInt();
030 this.effectId = par1DataInputStream.readByte();
031 }
032
033 /**
034 * Abstract. Writes the raw packet data to the data stream.
035 */
036 public void writePacketData(DataOutputStream par1DataOutputStream) throws IOException
037 {
038 par1DataOutputStream.writeInt(this.entityId);
039 par1DataOutputStream.writeByte(this.effectId);
040 }
041
042 /**
043 * Passes this Packet on to the NetHandler for processing.
044 */
045 public void processPacket(NetHandler par1NetHandler)
046 {
047 par1NetHandler.handleRemoveEntityEffect(this);
048 }
049
050 /**
051 * Abstract. Return the size of the packet (not counting the header).
052 */
053 public int getPacketSize()
054 {
055 return 5;
056 }
057 }