001package net.minecraft.network.packet;
002
003import java.io.DataInputStream;
004import java.io.DataOutputStream;
005import java.io.IOException;
006import net.minecraft.scoreboard.ScoreObjective;
007
008public class Packet206SetObjective extends Packet
009{
010    public String objectiveName;
011    public String objectiveDisplayName;
012
013    /**
014     * 0 to create scoreboard, 1 to remove scoreboard, 2 to update display text.
015     */
016    public int change;
017
018    public Packet206SetObjective() {}
019
020    public Packet206SetObjective(ScoreObjective par1, int par2)
021    {
022        this.objectiveName = par1.getName();
023        this.objectiveDisplayName = par1.getDisplayName();
024        this.change = par2;
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.objectiveName = readString(par1DataInputStream, 16);
033        this.objectiveDisplayName = readString(par1DataInputStream, 32);
034        this.change = par1DataInputStream.readByte();
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        writeString(this.objectiveName, par1DataOutputStream);
043        writeString(this.objectiveDisplayName, par1DataOutputStream);
044        par1DataOutputStream.writeByte(this.change);
045    }
046
047    /**
048     * Passes this Packet on to the NetHandler for processing.
049     */
050    public void processPacket(NetHandler par1NetHandler)
051    {
052        par1NetHandler.handleSetObjective(this);
053    }
054
055    /**
056     * Abstract. Return the size of the packet (not counting the header).
057     */
058    public int getPacketSize()
059    {
060        return 2 + this.objectiveName.length() + 2 + this.objectiveDisplayName.length() + 1;
061    }
062}