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.entity.Entity;
007
008 public class Packet17Sleep extends Packet
009 {
010 public int entityID;
011 public int bedX;
012 public int bedY;
013 public int bedZ;
014 public int field_73622_e;
015
016 public Packet17Sleep() {}
017
018 public Packet17Sleep(Entity par1Entity, int par2, int par3, int par4, int par5)
019 {
020 this.field_73622_e = par2;
021 this.bedX = par3;
022 this.bedY = par4;
023 this.bedZ = par5;
024 this.entityID = par1Entity.entityId;
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.entityID = par1DataInputStream.readInt();
033 this.field_73622_e = par1DataInputStream.readByte();
034 this.bedX = par1DataInputStream.readInt();
035 this.bedY = par1DataInputStream.readByte();
036 this.bedZ = par1DataInputStream.readInt();
037 }
038
039 /**
040 * Abstract. Writes the raw packet data to the data stream.
041 */
042 public void writePacketData(DataOutputStream par1DataOutputStream) throws IOException
043 {
044 par1DataOutputStream.writeInt(this.entityID);
045 par1DataOutputStream.writeByte(this.field_73622_e);
046 par1DataOutputStream.writeInt(this.bedX);
047 par1DataOutputStream.writeByte(this.bedY);
048 par1DataOutputStream.writeInt(this.bedZ);
049 }
050
051 /**
052 * Passes this Packet on to the NetHandler for processing.
053 */
054 public void processPacket(NetHandler par1NetHandler)
055 {
056 par1NetHandler.handleSleep(this);
057 }
058
059 /**
060 * Abstract. Return the size of the packet (not counting the header).
061 */
062 public int getPacketSize()
063 {
064 return 14;
065 }
066 }