Initial commit: RegionIO Minecraft server core (26.1.2/protocol 775)
Vanilla-faithful overworld generator (final_density + multi-noise biomes), full connection lifecycle (status/login/configuration/play), chunk streaming, creative block editing, and the protocol/nbt/registry infrastructure.
This commit is contained in:
commit
a7bb9496ae
146 changed files with 217621 additions and 0 deletions
21
internal/server/profile.go
Normal file
21
internal/server/profile.go
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
package server
|
||||
|
||||
import (
|
||||
"crypto/md5"
|
||||
)
|
||||
|
||||
// Profile is an authenticated (or, in offline mode, derived) player identity.
|
||||
type Profile struct {
|
||||
UUID [16]byte
|
||||
Name string
|
||||
}
|
||||
|
||||
// OfflineUUID derives the stable offline-mode UUID for a username, matching
|
||||
// vanilla's java.util.UUID.nameUUIDFromBytes("OfflinePlayer:" + name): an
|
||||
// MD5-based (version 3) UUID with the IETF variant bits set.
|
||||
func OfflineUUID(name string) [16]byte {
|
||||
sum := md5.Sum([]byte("OfflinePlayer:" + name))
|
||||
sum[6] = (sum[6] & 0x0f) | 0x30 // version 3
|
||||
sum[8] = (sum[8] & 0x3f) | 0x80 // IETF variant
|
||||
return sum
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue