Skip to content

Emote binary

KosmX edited this page Aug 13, 2021 · 5 revisions

Emote binary format

Emote binary format is used for networking and for saving emotes into files

The binary array is a modular format type.

The order of these bytes is important.

long: 8 bytes int: 4 bytes short: 2 bytes String: int showing the size, then the byte array. Using Java ByteBuffer native endianness, BIG_ENDIAN

  • int: version format number
  • byte: purpose id. see enum PacketTask
  • byte: modules count. without the header (this)
  • modules:
    • byte: module ID. see package-info.java
    • byte: module version.
    • int: module size in bytes without the module describer.
    • module bytes[]

Modules are located in emotes/emotesCommon/src/main/java/io/github/kosmx/emotes/common/network/objects/
And are published in emtotesAPI io.github.kosmx.emotes.common.network.objects

Networking

Emotecraft exchanges data with emote binary packages. The packet task tells the purpose of a message.
Channel is registered in emotes:emote plugin channel.
The mod does not send any extra data in the message, even in Forge implementations.

Writing and Reading with EmotesAPI

EmotesAPI provides an easy way to write/read emote packets/files.
For more information, see kosmx/emotes-proxy-template
EmotePacket.Builder packetBuilder = new EmotePacket.Builder();