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 Packet203AutoComplete extends Packet
008    {
009        /**
010         * Sent by the client containing the text to be autocompleted. Sent by the server with possible completions
011         * separated by null (two bytes in UTF-16)
012         */
013        private String text;
014    
015        public Packet203AutoComplete() {}
016    
017        public Packet203AutoComplete(String par1Str)
018        {
019            this.text = par1Str;
020        }
021    
022        /**
023         * Abstract. Reads the raw packet data from the data stream.
024         */
025        public void readPacketData(DataInputStream par1DataInputStream) throws IOException
026        {
027            this.text = readString(par1DataInputStream, Packet3Chat.maxChatLength);
028        }
029    
030        /**
031         * Abstract. Writes the raw packet data to the data stream.
032         */
033        public void writePacketData(DataOutputStream par1DataOutputStream) throws IOException
034        {
035            writeString(this.text, par1DataOutputStream);
036        }
037    
038        /**
039         * Passes this Packet on to the NetHandler for processing.
040         */
041        public void processPacket(NetHandler par1NetHandler)
042        {
043            par1NetHandler.handleAutoComplete(this);
044        }
045    
046        /**
047         * Abstract. Return the size of the packet (not counting the header).
048         */
049        public int getPacketSize()
050        {
051            return 2 + this.text.length() * 2;
052        }
053    
054        public String getText()
055        {
056            return this.text;
057        }
058    
059        /**
060         * only false for the abstract Packet class, all real packets return true
061         */
062        public boolean isRealPacket()
063        {
064            return true;
065        }
066    
067        /**
068         * eg return packet30entity.entityId == entityId; WARNING : will throw if you compare a packet to a different packet
069         * class
070         */
071        public boolean containsSameEntityIDAs(Packet par1Packet)
072        {
073            return true;
074        }
075    }