Package net.minecraft.src
Class Packet
java.lang.Object
net.minecraft.src.Packet
- Direct Known Subclasses:
DebugInfoPacket,GameruleSyncPacket,HardcoreSpawnPacket,Packet0KeepAlive,Packet100OpenWindow,Packet101CloseWindow,Packet102WindowClick,Packet103SetSlot,Packet104WindowItems,Packet105UpdateProgressbar,Packet106Transaction,Packet107CreativeSetSlot,Packet108EnchantItem,Packet10Flying,Packet130UpdateSign,Packet131MapData,Packet132TileEntityData,Packet133TileEditorOpen,Packet14BlockDig,Packet15Place,Packet16BlockItemSwitch,Packet17Sleep,Packet18Animation,Packet19EntityAction,Packet1Login,Packet200Statistic,Packet201PlayerInfo,Packet202PlayerAbilities,Packet203AutoComplete,Packet204ClientInfo,Packet205ClientCommand,Packet206SetObjective,Packet207SetScore,Packet208SetDisplayObjective,Packet209SetPlayerTeam,Packet20NamedEntitySpawn,Packet22Collect,Packet23VehicleSpawn,Packet24MobSpawn,Packet250CustomPayload,Packet252SharedKey,Packet253ServerAuthData,Packet254ServerPing,Packet255KickDisconnect,Packet25EntityPainting,Packet26EntityExpOrb,Packet27PlayerInput,Packet28EntityVelocity,Packet29DestroyEntity,Packet2ClientProtocol,Packet30Entity,Packet34EntityTeleport,Packet35EntityHeadRotation,Packet38EntityStatus,Packet39AttachEntity,Packet3Chat,Packet40EntityMetadata,Packet41EntityEffect,Packet42RemoveEntityEffect,Packet43Experience,Packet44UpdateAttributes,Packet4UpdateTime,Packet51MapChunk,Packet52MultiBlockChange,Packet53BlockChange,Packet54PlayNoteBlock,Packet55BlockDestroy,Packet56MapChunks,Packet5PlayerInventory,Packet60Explosion,Packet61DoorChange,Packet62LevelSound,Packet63WorldParticles,Packet6SpawnPosition,Packet70GameEvent,Packet71Weather,Packet7UseEntity,Packet8UpdateHealth,Packet9Respawn,PlayerSyncPacket,StartBlockHarvestPacket,TimerSpeedPacket
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal longthe system time in milliseconds when this packet was created.protected ILogAgentbooleanOnly true for Packet51MapChunk, Packet52MultiBlockChange, Packet53BlockChange and Packet59ComplexEntity.static IntHashMapMaps packet id to packet classstatic longstatic longstatic longAssumed to be sequential by the profiler.static long -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddIdClassMapping(int par0, boolean par1, boolean par2, Class par3Class) Adds a two way mapping between the packet ID and packet class.booleanIf this returns true, the packet may be processed on any thread; otherwise it is queued for the main thread to handle.booleancontainsSameEntityIDAs(Packet par1Packet) eg return packet30entity.entityId == entityId; WARNING : will throw if you compare a packet to a different packet classstatic PacketgetNewPacket(ILogAgent par0ILogAgent, int par1) Returns a new instance of the specified Packet class.final intReturns the ID of this packet.abstract intAbstract.booleanonly false for the abstract Packet class, all real packets return trueabstract voidprocessPacket(NetHandler var1) Passes this Packet on to the NetHandler for processing.static byte[]readBytesFromStream(DataInput par0DataInput) the first short in the stream indicates the number of bytes to readstatic ItemStackreadItemStack(DataInput par0DataInput) Reads a ItemStack from the InputStreamstatic NBTTagCompoundreadNBTTagCompound(DataInput par0DataInput) Reads a compressed NBTTagCompound from the InputStreamstatic PacketreadPacket(ILogAgent par0ILogAgent, DataInput par1DataInput, boolean par2, Socket par3Socket) Read a packet, prefixed by its ID, from the data stream.abstract voidreadPacketData(DataInput var1) Abstract.static StringreadString(DataInput par0DataInput, int par1) Reads a string from a packettoString()static voidwriteByteArray(DataOutput par0DataOutput, byte[] par1ArrayOfByte) Writes a byte array to the DataOutputStreamstatic voidwriteItemStack(ItemStack par0ItemStack, DataOutput par1DataOutput) Writes the ItemStack's ID (short), then size (byte), then damage.protected static voidwriteNBTTagCompound(NBTTagCompound par0NBTTagCompound, DataOutput par1DataOutput) Writes a compressed NBTTagCompound to the OutputStreamstatic voidwritePacket(Packet par0Packet, DataOutput par1DataOutput) Writes a packet, prefixed by its ID, to the data stream.abstract voidwritePacketData(DataOutput var1) Abstract.static voidwriteString(String par0Str, DataOutput par1DataOutput) Writes a String to the DataOutputStream
-
Field Details
-
packetIdToClassMap
Maps packet id to packet class -
field_98193_m
-
creationTimeMillis
public final long creationTimeMillisthe system time in milliseconds when this packet was created. -
receivedID
public static long receivedID -
receivedSize
public static long receivedSize -
sentID
public static long sentIDAssumed to be sequential by the profiler. -
sentSize
public static long sentSize -
isChunkDataPacket
public boolean isChunkDataPacketOnly true for Packet51MapChunk, Packet52MultiBlockChange, Packet53BlockChange and Packet59ComplexEntity. Used to separate them into a different send queue.
-
-
Constructor Details
-
Packet
public Packet()
-
-
Method Details
-
addIdClassMapping
Adds a two way mapping between the packet ID and packet class. -
getNewPacket
Returns a new instance of the specified Packet class. -
writeByteArray
public static void writeByteArray(DataOutput par0DataOutput, byte[] par1ArrayOfByte) throws IOException Writes a byte array to the DataOutputStream- Throws:
IOException
-
readBytesFromStream
the first short in the stream indicates the number of bytes to read- Throws:
IOException
-
getPacketId
public final int getPacketId()Returns the ID of this packet. -
readPacket
public static Packet readPacket(ILogAgent par0ILogAgent, DataInput par1DataInput, boolean par2, Socket par3Socket) throws IOException Read a packet, prefixed by its ID, from the data stream.- Throws:
IOException
-
writePacket
Writes a packet, prefixed by its ID, to the data stream.- Throws:
IOException
-
writeString
Writes a String to the DataOutputStream- Throws:
IOException
-
readString
Reads a string from a packet- Throws:
IOException
-
readPacketData
Abstract. Reads the raw packet data from the data stream.- Throws:
IOException
-
writePacketData
Abstract. Writes the raw packet data to the data stream.- Throws:
IOException
-
processPacket
Passes this Packet on to the NetHandler for processing. -
getPacketSize
public abstract int getPacketSize()Abstract. Return the size of the packet (not counting the header). -
isRealPacket
public boolean isRealPacket()only false for the abstract Packet class, all real packets return true -
containsSameEntityIDAs
eg return packet30entity.entityId == entityId; WARNING : will throw if you compare a packet to a different packet class -
canProcessAsync
public boolean canProcessAsync()If this returns true, the packet may be processed on any thread; otherwise it is queued for the main thread to handle. -
toString
-
readItemStack
Reads a ItemStack from the InputStream- Throws:
IOException
-
writeItemStack
public static void writeItemStack(ItemStack par0ItemStack, DataOutput par1DataOutput) throws IOException Writes the ItemStack's ID (short), then size (byte), then damage. (short)- Throws:
IOException
-
readNBTTagCompound
Reads a compressed NBTTagCompound from the InputStream- Throws:
IOException
-
writeNBTTagCompound
protected static void writeNBTTagCompound(NBTTagCompound par0NBTTagCompound, DataOutput par1DataOutput) throws IOException Writes a compressed NBTTagCompound to the OutputStream- Throws:
IOException
-