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.item.EntityPainting;
007 import net.minecraft.util.EnumArt;
008
009 public class Packet25EntityPainting extends Packet
010 {
011 public int entityId;
012 public int xPosition;
013 public int yPosition;
014 public int zPosition;
015 public int direction;
016 public String title;
017
018 public Packet25EntityPainting() {}
019
020 public Packet25EntityPainting(EntityPainting par1EntityPainting)
021 {
022 this.entityId = par1EntityPainting.entityId;
023 this.xPosition = par1EntityPainting.xPosition;
024 this.yPosition = par1EntityPainting.yPosition;
025 this.zPosition = par1EntityPainting.zPosition;
026 this.direction = par1EntityPainting.hangingDirection;
027 this.title = par1EntityPainting.art.title;
028 }
029
030 /**
031 * Abstract. Reads the raw packet data from the data stream.
032 */
033 public void readPacketData(DataInputStream par1DataInputStream) throws IOException
034 {
035 this.entityId = par1DataInputStream.readInt();
036 this.title = readString(par1DataInputStream, EnumArt.maxArtTitleLength);
037 this.xPosition = par1DataInputStream.readInt();
038 this.yPosition = par1DataInputStream.readInt();
039 this.zPosition = par1DataInputStream.readInt();
040 this.direction = par1DataInputStream.readInt();
041 }
042
043 /**
044 * Abstract. Writes the raw packet data to the data stream.
045 */
046 public void writePacketData(DataOutputStream par1DataOutputStream) throws IOException
047 {
048 par1DataOutputStream.writeInt(this.entityId);
049 writeString(this.title, par1DataOutputStream);
050 par1DataOutputStream.writeInt(this.xPosition);
051 par1DataOutputStream.writeInt(this.yPosition);
052 par1DataOutputStream.writeInt(this.zPosition);
053 par1DataOutputStream.writeInt(this.direction);
054 }
055
056 /**
057 * Passes this Packet on to the NetHandler for processing.
058 */
059 public void processPacket(NetHandler par1NetHandler)
060 {
061 par1NetHandler.handleEntityPainting(this);
062 }
063
064 /**
065 * Abstract. Return the size of the packet (not counting the header).
066 */
067 public int getPacketSize()
068 {
069 return 24;
070 }
071 }