Files
go-mc/server/configuration.go
patyhank 185020e31c
Some checks failed
CodeQL / Analyze (go) (push) Has been cancelled
Go / Test (1.22) (push) Has been cancelled
Go / Test (^1.22) (push) Has been cancelled
Squashed below commits
nbt chat message

fixes some bug

chunk temp

relocate module

items id
2025-08-27 20:29:40 +08:00

40 lines
843 B
Go

package server
import (
"git.konjactw.dev/falloutBot/go-mc/chat"
"git.konjactw.dev/falloutBot/go-mc/data/packetid"
"git.konjactw.dev/falloutBot/go-mc/net"
pk "git.konjactw.dev/falloutBot/go-mc/net/packet"
"git.konjactw.dev/falloutBot/go-mc/registry"
)
type ConfigHandler interface {
AcceptConfig(conn *net.Conn) error
}
type Configurations struct {
Registries registry.Registries
}
func (c *Configurations) AcceptConfig(conn *net.Conn) error {
err := conn.WritePacket(pk.Marshal(
packetid.ClientboundConfigRegistryData,
pk.NBT(c.Registries),
))
if err != nil {
return err
}
err = conn.WritePacket(pk.Marshal(
packetid.ClientboundConfigFinishConfiguration,
))
return err
}
type ConfigFailErr struct {
reason chat.Message
}
func (c ConfigFailErr) Error() string {
return "config error: " + c.reason.ClearString()
}