void DataWatcher::write(PacketBuffer &buffer) { for (byte_t index = 0; index < 23; ++index) { if (type[index] == NONE) continue; buffer.putByte(type[index] << 5 | (index & 0x1f)); switch (type[index]) { case BYTE: buffer.putByte(getByte(index)); break; case SHORT: buffer.putShort(getShort(index)); break; case INT: buffer.putInt(getInt(index)); break; case FLOAT: buffer.putFloat(getFloat(index)); break; case STRING: buffer.putString(getString(index)); break; case ITEMSTACK: buffer.putItemStack(getItemStack(index)); break; } } buffer.putByte(0x7f); }
void PacketJoinGame::write(PacketBuffer &buffer) { buffer.putInt(entityId); buffer.putUByte(gameMode); buffer.putByte(dimension); buffer.putUByte(difficulty); buffer.putUByte(maxPlayers); buffer.putString(levelType); buffer.putBool(reducedDebugInfo); }