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 Packet130UpdateSign extends Packet
008 {
009 public int xPosition;
010 public int yPosition;
011 public int zPosition;
012 public String[] signLines;
013
014 public Packet130UpdateSign()
015 {
016 this.isChunkDataPacket = true;
017 }
018
019 public Packet130UpdateSign(int par1, int par2, int par3, String[] par4ArrayOfStr)
020 {
021 this.isChunkDataPacket = true;
022 this.xPosition = par1;
023 this.yPosition = par2;
024 this.zPosition = par3;
025 this.signLines = new String[] {par4ArrayOfStr[0], par4ArrayOfStr[1], par4ArrayOfStr[2], par4ArrayOfStr[3]};
026 }
027
028 /**
029 * Abstract. Reads the raw packet data from the data stream.
030 */
031 public void readPacketData(DataInputStream par1DataInputStream) throws IOException
032 {
033 this.xPosition = par1DataInputStream.readInt();
034 this.yPosition = par1DataInputStream.readShort();
035 this.zPosition = par1DataInputStream.readInt();
036 this.signLines = new String[4];
037
038 for (int var2 = 0; var2 < 4; ++var2)
039 {
040 this.signLines[var2] = readString(par1DataInputStream, 15);
041 }
042 }
043
044 /**
045 * Abstract. Writes the raw packet data to the data stream.
046 */
047 public void writePacketData(DataOutputStream par1DataOutputStream) throws IOException
048 {
049 par1DataOutputStream.writeInt(this.xPosition);
050 par1DataOutputStream.writeShort(this.yPosition);
051 par1DataOutputStream.writeInt(this.zPosition);
052
053 for (int var2 = 0; var2 < 4; ++var2)
054 {
055 writeString(this.signLines[var2], par1DataOutputStream);
056 }
057 }
058
059 /**
060 * Passes this Packet on to the NetHandler for processing.
061 */
062 public void processPacket(NetHandler par1NetHandler)
063 {
064 par1NetHandler.handleUpdateSign(this);
065 }
066
067 /**
068 * Abstract. Return the size of the packet (not counting the header).
069 */
070 public int getPacketSize()
071 {
072 int var1 = 0;
073
074 for (int var2 = 0; var2 < 4; ++var2)
075 {
076 var1 += this.signLines[var2].length();
077 }
078
079 return var1;
080 }
081 }