Пример #1
0
// JustLoginMetadata return default metadata for players who just got in.
func JustLoginMetadata(name string) mct.Metadata {
	meta := mct.NewMetadata()
	meta.Entries[0] = &mct.EntryByte{0}                  // Actions
	meta.Entries[1] = &mct.EntryShort{300}               // Drowning counter
	meta.Entries[5] = &mct.EntryString{mct.String(name)} // Plate name
	meta.Entries[6] = &mct.EntryByte{1}                  // Show plate
	meta.Entries[8] = &mct.EntryInt{0}                   // Potion effects
	return meta
}
Пример #2
0
func (rw MustReadWriter) ReadMetadata(r io.Reader) (res mct.Metadata) {
	if rw.Err != nil {
		return
	}

	t := mct.NewMetadata()
	n, err := t.ReadFrom(r)
	if err != nil {
		rw.Err = fmt.Errorf("ReadMetadata: %s", err)
		return
	}
	rw.N += n

	return t
}