001 package net.minecraft.network.packet;
002
003 import java.io.DataInputStream;
004 import java.io.DataOutputStream;
005 import java.io.IOException;
006
007 public class Packet43Experience extends Packet
008 {
009 /** The current experience bar points. */
010 public float experience;
011
012 /** The total experience points. */
013 public int experienceTotal;
014
015 /** The experience level. */
016 public int experienceLevel;
017
018 public Packet43Experience() {}
019
020 public Packet43Experience(float par1, int par2, int par3)
021 {
022 this.experience = par1;
023 this.experienceTotal = par2;
024 this.experienceLevel = par3;
025 }
026
027 /**
028 * Abstract. Reads the raw packet data from the data stream.
029 */
030 public void readPacketData(DataInputStream par1DataInputStream) throws IOException
031 {
032 this.experience = par1DataInputStream.readFloat();
033 this.experienceLevel = par1DataInputStream.readShort();
034 this.experienceTotal = par1DataInputStream.readShort();
035 }
036
037 /**
038 * Abstract. Writes the raw packet data to the data stream.
039 */
040 public void writePacketData(DataOutputStream par1DataOutputStream) throws IOException
041 {
042 par1DataOutputStream.writeFloat(this.experience);
043 par1DataOutputStream.writeShort(this.experienceLevel);
044 par1DataOutputStream.writeShort(this.experienceTotal);
045 }
046
047 /**
048 * Passes this Packet on to the NetHandler for processing.
049 */
050 public void processPacket(NetHandler par1NetHandler)
051 {
052 par1NetHandler.handleExperience(this);
053 }
054
055 /**
056 * Abstract. Return the size of the packet (not counting the header).
057 */
058 public int getPacketSize()
059 {
060 return 4;
061 }
062
063 /**
064 * only false for the abstract Packet class, all real packets return true
065 */
066 public boolean isRealPacket()
067 {
068 return true;
069 }
070
071 /**
072 * eg return packet30entity.entityId == entityId; WARNING : will throw if you compare a packet to a different packet
073 * class
074 */
075 public boolean containsSameEntityIDAs(Packet par1Packet)
076 {
077 return true;
078 }
079 }