You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 9, 2017. It is now read-only.
SirCmpwn edited this page Dec 27, 2012
·
1 revision
Craft.Net can be used to parse the Minecraft protocol and handle a few related tasks.
Code
All packets are defined in Packets.cs and inherit from IPacket (defined in the same file). Packets include ReadPacket(MinecraftStream) for reading them (does not include packet ID), as well as WritePacket(MinecraftStream) for writing them (includes packet ID). You can use PacketReader to read and produce fully populated packet objects. Additionally, various streams are included. MinecraftStream is split into two files - MinecraftStream.cs, which only includes methods to read/write Minecraft data types, and MinecraftStream.Stream.cs, which includes abstract members of System.IO.Stream.
Streams
Various streams are included to make things easier, and they are intended to be nested.
MinecraftStream: Used to read/write Minecraft data types. Used by all packets.
BufferedStream: Unlike System.IO.BufferedStream, this simply queues up all writes until Flush() is called.
AesStream: Encrypts on write and decrypts on read with AES/CFB.
Cryptography
Crypto utilities are included:
Cryptography.JavaHexDigest for getting Minecraft-style SHA-1 hex digests, which are used for communicating with minecraft.net for authentication
AsnKeyBuilder and AsnKeyParser for working with ASN X.509 certificates
AesStream for encrypting or decrypting streams
ItemStack and MetadataDictionary
ItemStacks hold some amount of the same item. They include an ID, count, metadata, and NBT. These represent things like items in an inventory, or item entities.
MetadataDictionary is used to represent entity metadata for network communication in the Entity Metadata Format.