version compat system

This commit is contained in:
adman
2026-03-11 09:18:58 +01:00
parent c516cc5283
commit 047c4d02ff
18 changed files with 258 additions and 101 deletions
+2 -2
View File
@@ -65,7 +65,7 @@ var voidChunk = &v1_21_8.PlayToClientPacketMapChunk{X: 3, Z: 3, Heightmaps: []st
Data []int64
}{Type: "motion_blocking", Data: []int64{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}}, ChunkData: v1_21_8.ByteArray{Val: []uint8{0x0, 0x0, 0x0, 0x0, 0x0, 0x39, 0x0, 0x0, 0x0, 0x0, 0x0, 0x39, 0x0, 0x0, 0x0, 0x0, 0x0, 0x39, 0x0, 0x0, 0x0, 0x0, 0x0, 0x39, 0x0, 0x0, 0x0, 0x0, 0x0, 0x39, 0x0, 0x0, 0x0, 0x0, 0x0, 0x39, 0x0, 0x0, 0x0, 0x0, 0x0, 0x39, 0x0, 0x0, 0x0, 0x0, 0x0, 0x39, 0x0, 0x0, 0x0, 0x0, 0x0, 0x39, 0x0, 0x0, 0x0, 0x0, 0x0, 0x39, 0x0, 0x0, 0x0, 0x0, 0x0, 0x39, 0x0, 0x0, 0x0, 0x0, 0x0, 0x39, 0x0, 0x0, 0x0, 0x0, 0x0, 0x39, 0x0, 0x0, 0x0, 0x0, 0x0, 0x39, 0x0, 0x0, 0x0, 0x0, 0x0, 0x39, 0x0, 0x0, 0x0, 0x0, 0x0, 0x39, 0x0, 0x0, 0x0, 0x0, 0x0, 0x39, 0x0, 0x0, 0x0, 0x0, 0x0, 0x39, 0x0, 0x0, 0x0, 0x0, 0x0, 0x39, 0x0, 0x0, 0x0, 0x0, 0x0, 0x39, 0x0, 0x0, 0x0, 0x0, 0x0, 0x39, 0x0, 0x0, 0x0, 0x0, 0x0, 0x39, 0x0, 0x0, 0x0, 0x0, 0x0, 0x39, 0x0, 0x0, 0x0, 0x0, 0x0, 0x39}}, BlockEntities: []v1_21_8.ChunkBlockEntity{}, SkyLightMask: []int64{}, BlockLightMask: []int64{}, EmptySkyLightMask: []int64{}, EmptyBlockLightMask: []int64{}, SkyLight: [][]uint8{}, BlockLight: [][]uint8{}}
func (s *Server) OnStart(_ event.Start) (err error) {
func (s *Server) OnStart() (err error) {
//goland:noinspection GoResourceLeak captures the conn object which should NOT be closed
playerData, err := server.ServeLogin(s.Conn, server.WithRawStatus(StatusResponse), server.WithCompatibleVersions(772))
if err != nil {
@@ -167,7 +167,7 @@ func (s *Server) SendKeepAlive() (err error) {
func main() {
slog.SetLogLoggerLevel(slog.LevelInfo)
err := server.StartServerWithFactory(":25565", func(c *proto.Conn) (h any, err error) {
err := server.StartServerWithFactory(":25565", func(c *proto.Conn) (h event.Handler, err error) {
s := &Server{Conn: c, MinCycle: 8297, MaxCycle: 8304, Current: 8297}
s.Timer = &event.Timer{}
h = s
+9
View File
@@ -8,9 +8,18 @@ import (
)
var addrFlag = flag.String("addr", "localhost:25565", "address to connect to")
var srvFlag = flag.Bool("srv", false, "use SRV records to resolve the address")
func main() {
flag.Parse()
var err error
if *srvFlag {
*addrFlag, err = client.DoDNS(*addrFlag)
if err != nil {
panic(err)
}
}
status, err := client.StatusRaw(*addrFlag)
if err != nil {
panic(err)