From 133de6f30cfec5b52036fd0f2cfc5776a85463d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robin=20Br=C3=A4mer?= Date: Fri, 25 Oct 2024 23:30:47 +0200 Subject: [PATCH] Support Minecraft 1.21.2-3 (#411) * Initial upgrade for Minecraft 1.21.2-3 * fix: show disconnect message in login state * fix: test --- .examples/extend/simple-proxy/go.mod | 12 ++--- .examples/extend/simple-proxy/go.sum | 6 +++ go.sum | 12 ----- pkg/edition/java/proto/nbtconv/snbt_json.go | 7 +-- .../proto/packet/chat/component_holder.go | 6 ++- .../java/proto/packet/clientsettings.go | 18 +++++-- pkg/edition/java/proto/packet/disconnect.go | 16 +++--- pkg/edition/java/proto/packet/joingame.go | 8 +++ pkg/edition/java/proto/packet/respawn.go | 7 +++ .../proto/packet/tablist/playerinfo/upsert.go | 16 +++++- pkg/edition/java/proto/state/register.go | 26 ++++++++++ pkg/edition/java/proto/util/nbt.go | 4 +- pkg/edition/java/proto/version/version.go | 3 +- pkg/edition/java/proxy/events.go | 9 ++-- pkg/edition/java/proxy/player.go | 15 +++--- pkg/edition/java/proxy/player/settings.go | 49 ++++++++++++++----- pkg/edition/java/proxy/session_client_play.go | 12 +++-- 17 files changed, 164 insertions(+), 62 deletions(-) diff --git a/.examples/extend/simple-proxy/go.mod b/.examples/extend/simple-proxy/go.mod index 72781e5c..ca3acec6 100644 --- a/.examples/extend/simple-proxy/go.mod +++ b/.examples/extend/simple-proxy/go.mod @@ -16,7 +16,7 @@ require ( github.com/Tnze/go-mc v1.20.2 // indirect github.com/agext/levenshtein v1.2.3 // indirect github.com/coder/websocket v1.8.12 // indirect - github.com/cpuguy83/go-md2man/v2 v2.0.4 // indirect + github.com/cpuguy83/go-md2man/v2 v2.0.5 // indirect github.com/dboslee/lru v0.0.1 // indirect github.com/edwingeng/deque/v2 v2.1.1 // indirect github.com/emirpasic/gods v1.18.1 // indirect @@ -30,13 +30,13 @@ require ( github.com/google/uuid v1.6.0 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/jellydator/ttlcache/v3 v3.3.0 // indirect - github.com/knadh/koanf/providers/file v1.1.1 // indirect + github.com/knadh/koanf/providers/file v1.1.2 // indirect github.com/lucasb-eyer/go-colorful v1.2.0 // indirect github.com/magiconair/properties v1.8.7 // indirect github.com/mitchellh/mapstructure v1.5.1-0.20220423185008-bf980b35cac4 // indirect github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 // indirect github.com/pelletier/go-toml/v2 v2.2.2 // indirect - github.com/pires/go-proxyproto v0.7.1-0.20240628150027-b718e7ce4964 // indirect + github.com/pires/go-proxyproto v0.8.0 // indirect github.com/rs/xid v1.6.0 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/sagikazarmark/locafero v0.6.0 // indirect @@ -48,7 +48,7 @@ require ( github.com/spf13/pflag v1.0.5 // indirect github.com/spf13/viper v1.19.0 // indirect github.com/subosito/gotenv v1.6.0 // indirect - github.com/urfave/cli/v2 v2.27.4 // indirect + github.com/urfave/cli/v2 v2.27.5 // indirect github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 // indirect github.com/zyedidia/generic v1.2.1 // indirect go.minekube.com/connect v0.6.2 // indirect @@ -58,8 +58,8 @@ require ( golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect golang.org/x/sync v0.8.0 // indirect golang.org/x/sys v0.24.0 // indirect - golang.org/x/text v0.18.0 // indirect - golang.org/x/time v0.6.0 // indirect + golang.org/x/text v0.19.0 // indirect + golang.org/x/time v0.7.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 // indirect google.golang.org/grpc v1.67.1 // indirect google.golang.org/protobuf v1.34.2 // indirect diff --git a/.examples/extend/simple-proxy/go.sum b/.examples/extend/simple-proxy/go.sum index 6ae1b6f3..ec990396 100644 --- a/.examples/extend/simple-proxy/go.sum +++ b/.examples/extend/simple-proxy/go.sum @@ -32,6 +32,7 @@ github.com/cpuguy83/go-md2man/v2 v2.0.3 h1:qMCsGGgs+MAzDFyp9LpAe1Lqy/fY/qCovCm0q github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/cpuguy83/go-md2man/v2 v2.0.4 h1:wfIWP927BUkWJb2NmU/kNDYIBTh/ziUX91+lVfRxZq4= github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/cpuguy83/go-md2man/v2 v2.0.5/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= @@ -115,6 +116,7 @@ github.com/knadh/koanf/providers/file v1.1.0 h1:MTjA+gRrVl1zqgetEAIaXHqYje0XSosx github.com/knadh/koanf/providers/file v1.1.0/go.mod h1:/faSBcv2mxPVjFrXck95qeoyoZ5myJ6uxN8OOVNJJCI= github.com/knadh/koanf/providers/file v1.1.1 h1:AyYV0SMrEzfw5O3cX5pGmKfq61/bhj19u7OQeFH5AHs= github.com/knadh/koanf/providers/file v1.1.1/go.mod h1:/faSBcv2mxPVjFrXck95qeoyoZ5myJ6uxN8OOVNJJCI= +github.com/knadh/koanf/providers/file v1.1.2/go.mod h1:/faSBcv2mxPVjFrXck95qeoyoZ5myJ6uxN8OOVNJJCI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= @@ -151,6 +153,7 @@ github.com/pires/go-proxyproto v0.7.1-0.20231012122632-e5b291b295b4 h1:VM7Tse0I0 github.com/pires/go-proxyproto v0.7.1-0.20231012122632-e5b291b295b4/go.mod h1:hm9CitpinLa2As6mIQh1AzhxHULm1BCYGUTbNcO6f2Q= github.com/pires/go-proxyproto v0.7.1-0.20240628150027-b718e7ce4964 h1:ct/vxNBgHpASQ4sT8NaBX9LtsEtluZqaUJydLG50U3E= github.com/pires/go-proxyproto v0.7.1-0.20240628150027-b718e7ce4964/go.mod h1:iknsfgnH8EkjrMeMyvfKByp9TiBZCKZM0jx2xmKqnVY= +github.com/pires/go-proxyproto v0.8.0/go.mod h1:iknsfgnH8EkjrMeMyvfKByp9TiBZCKZM0jx2xmKqnVY= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= @@ -240,6 +243,7 @@ github.com/urfave/cli/v2 v2.27.3 h1:/POWahRmdh7uztQ3CYnaDddk0Rm90PyOgIxgW2rr41M= github.com/urfave/cli/v2 v2.27.3/go.mod h1:m4QzxcD2qpra4z7WhzEGn74WZLViBnMpb1ToCAKdGRQ= github.com/urfave/cli/v2 v2.27.4 h1:o1owoI+02Eb+K107p27wEX9Bb8eqIoZCfLXloLUSWJ8= github.com/urfave/cli/v2 v2.27.4/go.mod h1:m4QzxcD2qpra4z7WhzEGn74WZLViBnMpb1ToCAKdGRQ= +github.com/urfave/cli/v2 v2.27.5/go.mod h1:3Sevf16NykTbInEnD0yKkjDAeZDS0A6bzhBH5hrMvTQ= github.com/viant/assertly v0.4.8/go.mod h1:aGifi++jvCrUaklKEKT0BU95igDNaqkvz+49uaYMPRU= github.com/viant/toolbox v0.24.0/go.mod h1:OxMCG57V0PXuIP2HNQrtJf2CjqdmbrOx5EkMILuUhzM= github.com/xrash/smetrics v0.0.0-20231213231151-1d8dd44e695e h1:+SOyEddqYF09QP7vr7CgJ1eti3pY9Fn3LHO1M1r/0sI= @@ -343,12 +347,14 @@ golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/time v0.6.0 h1:eTDhh4ZXt5Qf0augr54TN6suAUudPcawVZeIAPU7D4U= golang.org/x/time v0.6.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/time v0.7.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181030000716-a0a13e073c7b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/go.sum b/go.sum index c4459607..37fd60d9 100644 --- a/go.sum +++ b/go.sum @@ -22,8 +22,6 @@ github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDk github.com/coder/websocket v1.8.12 h1:5bUXkEPPIbewrnkU8LTCLVaxi4N4J8ahufH2vlo4NAo= github.com/coder/websocket v1.8.12/go.mod h1:LNVeNrXQZfe5qhS9ALED3uA+l5pPqvwXg3CKoDBB2gs= github.com/coreos/go-systemd v0.0.0-20181012123002-c6f51f82210d/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/cpuguy83/go-md2man/v2 v2.0.4 h1:wfIWP927BUkWJb2NmU/kNDYIBTh/ziUX91+lVfRxZq4= -github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/cpuguy83/go-md2man/v2 v2.0.5 h1:ZtcqGrnekaHpVLArFSe4HK5DoKx1T0rq2DwVB0alcyc= github.com/cpuguy83/go-md2man/v2 v2.0.5/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -98,8 +96,6 @@ github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1 github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/compress v1.17.2 h1:RlWWUY/Dr4fL8qk9YG7DTZ7PDgME2V4csBXA8L/ixi4= github.com/klauspost/compress v1.17.2/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= -github.com/knadh/koanf/providers/file v1.1.1 h1:AyYV0SMrEzfw5O3cX5pGmKfq61/bhj19u7OQeFH5AHs= -github.com/knadh/koanf/providers/file v1.1.1/go.mod h1:/faSBcv2mxPVjFrXck95qeoyoZ5myJ6uxN8OOVNJJCI= github.com/knadh/koanf/providers/file v1.1.2 h1:aCC36YGOgV5lTtAFz2qkgtWdeQsgfxUkxDOe+2nQY3w= github.com/knadh/koanf/providers/file v1.1.2/go.mod h1:/faSBcv2mxPVjFrXck95qeoyoZ5myJ6uxN8OOVNJJCI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= @@ -130,8 +126,6 @@ github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646/go.mod h1:jpp1/29i3P1S github.com/openzipkin/zipkin-go v0.1.1/go.mod h1:NtoC/o8u3JlF1lSlyPNswIbeQH9bJTmOf0Erfk+hxe8= github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= -github.com/pires/go-proxyproto v0.7.1-0.20240628150027-b718e7ce4964 h1:ct/vxNBgHpASQ4sT8NaBX9LtsEtluZqaUJydLG50U3E= -github.com/pires/go-proxyproto v0.7.1-0.20240628150027-b718e7ce4964/go.mod h1:iknsfgnH8EkjrMeMyvfKByp9TiBZCKZM0jx2xmKqnVY= github.com/pires/go-proxyproto v0.8.0 h1:5unRmEAPbHXHuLjDg01CxJWf91cw3lKHc/0xzKpXEe0= github.com/pires/go-proxyproto v0.8.0/go.mod h1:iknsfgnH8EkjrMeMyvfKByp9TiBZCKZM0jx2xmKqnVY= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -211,8 +205,6 @@ github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8 github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA= -github.com/urfave/cli/v2 v2.27.4 h1:o1owoI+02Eb+K107p27wEX9Bb8eqIoZCfLXloLUSWJ8= -github.com/urfave/cli/v2 v2.27.4/go.mod h1:m4QzxcD2qpra4z7WhzEGn74WZLViBnMpb1ToCAKdGRQ= github.com/urfave/cli/v2 v2.27.5 h1:WoHEJLdsXr6dDWoJgMq/CboDmyY/8HMMH1fTECbih+w= github.com/urfave/cli/v2 v2.27.5/go.mod h1:3Sevf16NykTbInEnD0yKkjDAeZDS0A6bzhBH5hrMvTQ= github.com/viant/assertly v0.4.8/go.mod h1:aGifi++jvCrUaklKEKT0BU95igDNaqkvz+49uaYMPRU= @@ -305,14 +297,10 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= -golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= -golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.6.0 h1:eTDhh4ZXt5Qf0augr54TN6suAUudPcawVZeIAPU7D4U= -golang.org/x/time v0.6.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/time v0.7.0 h1:ntUhktv3OPE6TgYxXWv9vKvUSJyIFJlyohwbkEwPrKQ= golang.org/x/time v0.7.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/pkg/edition/java/proto/nbtconv/snbt_json.go b/pkg/edition/java/proto/nbtconv/snbt_json.go index 15b3688b..303da702 100644 --- a/pkg/edition/java/proto/nbtconv/snbt_json.go +++ b/pkg/edition/java/proto/nbtconv/snbt_json.go @@ -5,13 +5,14 @@ import ( "context" "encoding/json" "fmt" - "github.com/Tnze/go-mc/nbt" - "gopkg.in/yaml.v3" "io" "log/slog" "regexp" "strconv" "strings" + + "github.com/Tnze/go-mc/nbt" + "gopkg.in/yaml.v3" ) // formatSNBT adds spaces after colons that are not within quotes. @@ -219,7 +220,7 @@ func SnbtToBinaryTag(snbt string) (nbt.RawMessage, error) { var m nbt.RawMessage if _, err = dec.Decode(&m); err != nil { - return m, fmt.Errorf("error decoding binary tag: %w", err) + return m, fmt.Errorf("error decoding snbt to binary tag: %w", err) } return m, nil } diff --git a/pkg/edition/java/proto/packet/chat/component_holder.go b/pkg/edition/java/proto/packet/chat/component_holder.go index a0be937b..8f2cb299 100644 --- a/pkg/edition/java/proto/packet/chat/component_holder.go +++ b/pkg/edition/java/proto/packet/chat/component_holder.go @@ -3,14 +3,16 @@ package chat import ( "encoding/json" "fmt" + "io" + "log/slog" + "github.com/Tnze/go-mc/nbt" "go.minekube.com/common/minecraft/component" + "go.minekube.com/gate/pkg/edition/java/proto/nbtconv" "go.minekube.com/gate/pkg/edition/java/proto/util" "go.minekube.com/gate/pkg/edition/java/proto/version" "go.minekube.com/gate/pkg/gate/proto" - "io" - "log/slog" ) func FromComponent(comp component.Component) *ComponentHolder { diff --git a/pkg/edition/java/proto/packet/clientsettings.go b/pkg/edition/java/proto/packet/clientsettings.go index 226ff47b..d54736e2 100644 --- a/pkg/edition/java/proto/packet/clientsettings.go +++ b/pkg/edition/java/proto/packet/clientsettings.go @@ -1,10 +1,11 @@ package packet import ( + "io" + "go.minekube.com/gate/pkg/edition/java/proto/util" "go.minekube.com/gate/pkg/edition/java/proto/version" "go.minekube.com/gate/pkg/gate/proto" - "io" ) type ClientSettings struct { @@ -15,8 +16,9 @@ type ClientSettings struct { Difficulty byte // 1.7 Protocol SkinParts byte MainHand int - ChatFilteringEnabled bool // 1.17+ + TextFilteringEnabled bool // 1.17+ ClientListingAllowed bool // 1.18+, overwrites server-list "anonymous" mode + ParticleStatus int // Added in 1.21.2 } func (s *ClientSettings) Encode(c *proto.PacketContext, wr io.Writer) error { @@ -32,10 +34,14 @@ func (s *ClientSettings) Encode(c *proto.PacketContext, wr io.Writer) error { if c.Protocol.GreaterEqual(version.Minecraft_1_9) { w.VarInt(s.MainHand) if c.Protocol.GreaterEqual(version.Minecraft_1_17) { - w.Bool(s.ChatFilteringEnabled) + w.Bool(s.TextFilteringEnabled) } if c.Protocol.GreaterEqual(version.Minecraft_1_18) { w.Bool(s.ClientListingAllowed) + + if c.Protocol.GreaterEqual(version.Minecraft_1_21_2) { + w.VarInt(s.ParticleStatus) + } } } return nil @@ -54,10 +60,14 @@ func (s *ClientSettings) Decode(c *proto.PacketContext, rd io.Reader) (err error if c.Protocol.GreaterEqual(version.Minecraft_1_9) { r.VarInt(&s.MainHand) if c.Protocol.GreaterEqual(version.Minecraft_1_17) { - r.Bool(&s.ChatFilteringEnabled) + r.Bool(&s.TextFilteringEnabled) } if c.Protocol.GreaterEqual(version.Minecraft_1_18) { r.Bool(&s.ClientListingAllowed) + + if c.Protocol.GreaterEqual(version.Minecraft_1_21_2) { + r.VarInt(&s.ParticleStatus) + } } } return nil diff --git a/pkg/edition/java/proto/packet/disconnect.go b/pkg/edition/java/proto/packet/disconnect.go index a6eb90de..9cb5f727 100644 --- a/pkg/edition/java/proto/packet/disconnect.go +++ b/pkg/edition/java/proto/packet/disconnect.go @@ -2,11 +2,13 @@ package packet import ( "errors" + "io" + "log/slog" + "go.minekube.com/common/minecraft/component" + "go.minekube.com/gate/pkg/edition/java/proto/packet/chat" "go.minekube.com/gate/pkg/edition/java/proto/state/states" - "io" - "log/slog" "go.minekube.com/gate/pkg/edition/java/proto/version" "go.minekube.com/gate/pkg/gate/proto" @@ -14,22 +16,21 @@ import ( type Disconnect struct { Reason *chat.ComponentHolder // nil-able - - // Not part of the packet data itself, - // but used to determine the state of the client. - State states.State } func (d *Disconnect) Encode(c *proto.PacketContext, wr io.Writer) error { if d.Reason == nil { return errors.New("no reason specified") } + if c.PacketID == 0x00 && c.Direction == proto.ClientBound { // states.LoginState + c.Protocol = version.Minecraft_1_20_2.Protocol + } return d.Reason.Write(wr, c.Protocol) } func (d *Disconnect) Decode(c *proto.PacketContext, rd io.Reader) (err error) { protocol := c.Protocol - if d.State == states.LoginState { + if c.PacketID == 0x00 && c.Direction == proto.ClientBound { // states.LoginState protocol = version.Minecraft_1_20_2.Protocol } d.Reason, err = chat.ReadComponentHolder(rd, protocol) @@ -49,6 +50,5 @@ func NewDisconnect(reason component.Component, protocol proto.Protocol, stat sta } return &Disconnect{ Reason: chat.FromComponentProtocol(reason, protocol), - State: stat, } } diff --git a/pkg/edition/java/proto/packet/joingame.go b/pkg/edition/java/proto/packet/joingame.go index adf6672c..deef9e6c 100644 --- a/pkg/edition/java/proto/packet/joingame.go +++ b/pkg/edition/java/proto/packet/joingame.go @@ -31,6 +31,7 @@ type JoinGame struct { SimulationDistance int // 1.18+ LastDeathPosition *DeathPosition // 1.19+ PortalCooldown int // 1.20+ + SeaLevel int // 1.21.2+ EnforcesSecureChat bool // 1.20.5+ } @@ -211,6 +212,9 @@ func (j *JoinGame) encode1202Up(c *proto.PacketContext, wr io.Writer) error { } else { w.Bool(false) } + if c.Protocol.GreaterEqual(version.Minecraft_1_21_2) { + w.VarInt(j.SeaLevel) + } w.VarInt(j.PortalCooldown) if c.Protocol.GreaterEqual(version.Minecraft_1_20_5) { w.Bool(j.EnforcesSecureChat) @@ -392,6 +396,10 @@ func (j *JoinGame) decode1202Up(c *proto.PacketContext, rd io.Reader) error { } } + if c.Protocol.GreaterEqual(version.Minecraft_1_21_2) { + r.VarInt(&j.SeaLevel) + } + r.VarInt(&j.PortalCooldown) if c.Protocol.GreaterEqual(version.Minecraft_1_20_5) { r.Bool(&j.EnforcesSecureChat) diff --git a/pkg/edition/java/proto/packet/respawn.go b/pkg/edition/java/proto/packet/respawn.go index cf236030..e980d3f0 100644 --- a/pkg/edition/java/proto/packet/respawn.go +++ b/pkg/edition/java/proto/packet/respawn.go @@ -21,6 +21,7 @@ type Respawn struct { CurrentDimensionData util.CompoundBinaryTag // 1.16.2+ LastDeathPosition *DeathPosition // 1.19+ PortalCooldown int // 1.20+ + SeaLevel int // 1.21.2+ } func (r *Respawn) Encode(c *proto.PacketContext, wr io.Writer) (err error) { @@ -70,6 +71,9 @@ func (r *Respawn) Encode(c *proto.PacketContext, wr io.Writer) (err error) { if c.Protocol.GreaterEqual(version.Minecraft_1_20) { w.VarInt(r.PortalCooldown) } + if c.Protocol.GreaterEqual(version.Minecraft_1_21_2) { + w.VarInt(r.SeaLevel) + } if c.Protocol.GreaterEqual(version.Minecraft_1_20_2) { w.Byte(r.DataToKeep) } @@ -138,6 +142,9 @@ func (r *Respawn) Decode(c *proto.PacketContext, rd io.Reader) (err error) { if c.Protocol.GreaterEqual(version.Minecraft_1_20) { pr.VarInt(&r.PortalCooldown) } + if c.Protocol.GreaterEqual(version.Minecraft_1_21_2) { + pr.VarInt(&r.SeaLevel) + } if c.Protocol.GreaterEqual(version.Minecraft_1_20_2) { pr.Byte(&r.DataToKeep) } diff --git a/pkg/edition/java/proto/packet/tablist/playerinfo/upsert.go b/pkg/edition/java/proto/packet/tablist/playerinfo/upsert.go index 20cddb0b..5df4c17f 100644 --- a/pkg/edition/java/proto/packet/tablist/playerinfo/upsert.go +++ b/pkg/edition/java/proto/packet/tablist/playerinfo/upsert.go @@ -22,7 +22,8 @@ type ( Listed bool Latency int // in milliseconds GameMode int - DisplayName *chat.ComponentHolder // nil-able + DisplayName *chat.ComponentHolder // nil-able + ListOrder int RemoteChatSession *chat.RemoteChatSession // nil-able } ) @@ -103,6 +104,7 @@ var ( UpdateListedAction UpsertAction = &updateListedAction{} UpdateLatencyAction UpsertAction = &updateLatencyAction{} UpdateDisplayNameAction UpsertAction = &updateDisplayNameAction{} + UpdateListOrderAction UpsertAction = &updateListOrderAction{} UpsertActions = []UpsertAction{ AddPlayerAction, @@ -111,6 +113,7 @@ var ( UpdateListedAction, UpdateLatencyAction, UpdateDisplayNameAction, + UpdateListOrderAction, } ) @@ -235,3 +238,14 @@ func (a *updateDisplayNameAction) Decode(c *proto.PacketContext, rd io.Reader, i } return err } + +type updateListOrderAction struct{} + +func (a *updateListOrderAction) Encode(c *proto.PacketContext, wr io.Writer, info *Entry) error { + return util.WriteVarInt(wr, info.ListOrder) +} + +func (a *updateListOrderAction) Decode(c *proto.PacketContext, rd io.Reader, info *Entry) (err error) { + info.ListOrder, err = util.ReadVarInt(rd) + return err +} diff --git a/pkg/edition/java/proto/state/register.go b/pkg/edition/java/proto/state/register.go index 8001230e..35dfd078 100644 --- a/pkg/edition/java/proto/state/register.go +++ b/pkg/edition/java/proto/state/register.go @@ -157,6 +157,7 @@ func init() { m(0x14, version.Minecraft_1_20_2), m(0x15, version.Minecraft_1_20_3), m(0x18, version.Minecraft_1_20_5), + m(0x1A, version.Minecraft_1_21_2), ) Play.ServerBound.Register(&plugin.Message{}, m(0x17, version.Minecraft_1_7_2), @@ -173,6 +174,7 @@ func init() { m(0x0F, version.Minecraft_1_20_2), m(0x10, version.Minecraft_1_20_3), m(0x12, version.Minecraft_1_20_5), + m(0x14, version.Minecraft_1_21_2), ) Play.ServerBound.Register(&p.ClientSettings{}, m(0x15, version.Minecraft_1_7_2), @@ -186,6 +188,7 @@ func init() { m(0x08, version.Minecraft_1_19_4), m(0x09, version.Minecraft_1_20_2), m(0x0A, version.Minecraft_1_20_5), + m(0x0C, version.Minecraft_1_21_2), ) Play.ServerBound.Register(&chat.LegacyChat{}, m(0x01, version.Minecraft_1_7_2), @@ -196,6 +199,7 @@ func init() { ) Play.ServerBound.Register(&chat.ChatAcknowledgement{}, m(0x03, version.Minecraft_1_19_3), + m(0x04, version.Minecraft_1_21_2), ) Play.ServerBound.Register(&chat.KeyedPlayerCommand{}, m(0x03, version.Minecraft_1_19), @@ -208,13 +212,16 @@ func init() { Play.ServerBound.Register(&chat.SessionPlayerCommand{}, m(0x04, version.Minecraft_1_19_3), m(0x05, version.Minecraft_1_20_5), + m(0x06, version.Minecraft_1_21_2), ) Play.ServerBound.Register(&chat.UnsignedPlayerCommand{}, m(0x04, version.Minecraft_1_20_5), + m(0x05, version.Minecraft_1_21_2), ) Play.ServerBound.Register(&chat.SessionPlayerChat{}, m(0x05, version.Minecraft_1_19_3), m(0x06, version.Minecraft_1_20_5), + m(0x07, version.Minecraft_1_21_2), ) Play.ServerBound.Register(&p.TabCompleteRequest{}, m(0x14, version.Minecraft_1_7_2), @@ -229,6 +236,7 @@ func init() { m(0x09, version.Minecraft_1_19_4), m(0x0A, version.Minecraft_1_20_2), m(0x0B, version.Minecraft_1_20_5), + m(0x0D, version.Minecraft_1_21_2), ) Play.ServerBound.Register(&p.ResourcePackResponse{}, m(0x19, version.Minecraft_1_8), @@ -243,10 +251,12 @@ func init() { m(0x27, version.Minecraft_1_20_2), m(0x28, version.Minecraft_1_20_3), m(0x2B, version.Minecraft_1_20_5), + m(0x2D, version.Minecraft_1_21_2), ) Play.ServerBound.Register(&config.FinishedUpdate{}, m(0x0B, version.Minecraft_1_20_2), m(0x0C, version.Minecraft_1_20_5), + m(0x0E, version.Minecraft_1_21_2), ) Play.ClientBound.Register(&p.KeepAlive{}, @@ -264,6 +274,7 @@ func init() { m(0x23, version.Minecraft_1_19_4), m(0x24, version.Minecraft_1_20_2), m(0x26, version.Minecraft_1_20_5), + m(0x27, version.Minecraft_1_21_2), ) Play.ClientBound.Register(&p.JoinGame{}, m(0x01, version.Minecraft_1_7_2), @@ -280,6 +291,7 @@ func init() { m(0x28, version.Minecraft_1_19_4), m(0x29, version.Minecraft_1_20_2), m(0x2B, version.Minecraft_1_20_5), + m(0x2C, version.Minecraft_1_21_2), ) Play.ClientBound.Register(&p.Respawn{}, m(0x07, version.Minecraft_1_7_2), @@ -352,6 +364,7 @@ func init() { m(0x68, version.Minecraft_1_20_2), m(0x6A, version.Minecraft_1_20_3), m(0x6D, version.Minecraft_1_20_5), + m(0x74, version.Minecraft_1_21_2), ) Play.ClientBound.Register(&legacytablist.PlayerListItem{}, m(0x38, version.Minecraft_1_7_2), @@ -385,6 +398,7 @@ func init() { m(0x5F, version.Minecraft_1_20_2), m(0x61, version.Minecraft_1_20_3), m(0x63, version.Minecraft_1_20_5), + m(0x6A, version.Minecraft_1_21_2), ) Play.ClientBound.Register(&title.Text{}, m(0x59, version.Minecraft_1_17), @@ -395,6 +409,7 @@ func init() { m(0x61, version.Minecraft_1_20_2), m(0x63, version.Minecraft_1_20_3), m(0x65, version.Minecraft_1_20_5), + m(0x6C, version.Minecraft_1_21_2), ) Play.ClientBound.Register(&title.Actionbar{}, m(0x41, version.Minecraft_1_17), @@ -405,6 +420,7 @@ func init() { m(0x48, version.Minecraft_1_20_2), m(0x4A, version.Minecraft_1_20_3), m(0x4C, version.Minecraft_1_20_5), + m(0x51, version.Minecraft_1_21_2), ) Play.ClientBound.Register(&title.Times{}, m(0x5A, version.Minecraft_1_17), @@ -415,6 +431,7 @@ func init() { m(0x62, version.Minecraft_1_20_2), m(0x64, version.Minecraft_1_20_3), m(0x66, version.Minecraft_1_20_5), + m(0x6D, version.Minecraft_1_21_2), ) Play.ClientBound.Register(&title.Clear{}, m(0x10, version.Minecraft_1_17), @@ -442,6 +459,7 @@ func init() { Play.ClientBound.Register(&p.RemoveResourcePack{}, m(0x43, version.Minecraft_1_20_3), m(0x45, version.Minecraft_1_20_5), + m(0x4A, version.Minecraft_1_21_2), ) Play.ClientBound.Register(&p.ResourcePackRequest{}, m(0x48, version.Minecraft_1_8), @@ -461,6 +479,7 @@ func init() { m(0x42, version.Minecraft_1_20_2), m(0x44, version.Minecraft_1_20_3), m(0x46, version.Minecraft_1_20_5), + m(0x4B, version.Minecraft_1_21_2), ) Play.ClientBound.Register(&p.TabCompleteResponse{}, m(0x3A, version.Minecraft_1_7_2), @@ -491,12 +510,14 @@ func init() { m(0x39, version.Minecraft_1_19_4), m(0x3B, version.Minecraft_1_20_2), m(0x3D, version.Minecraft_1_20_5), + m(0x3F, version.Minecraft_1_21_2), ) Play.ClientBound.Register(&playerinfo.Upsert{}, m(0x36, version.Minecraft_1_19_3), m(0x3A, version.Minecraft_1_19_4), m(0x3C, version.Minecraft_1_20_2), m(0x3E, version.Minecraft_1_20_5), + m(0x40, version.Minecraft_1_21_2), ) Play.ClientBound.Register(&chat.SystemChat{}, m(0x5F, version.Minecraft_1_19), @@ -506,6 +527,7 @@ func init() { m(0x67, version.Minecraft_1_20_2), m(0x69, version.Minecraft_1_20_3), m(0x6C, version.Minecraft_1_20_5), + m(0x73, version.Minecraft_1_21_2), ) Play.ClientBound.Register(&p.PlayerChatCompletion{}, m(0x15, version.Minecraft_1_19_1), @@ -522,11 +544,13 @@ func init() { m(0x47, version.Minecraft_1_20_2), m(0x49, version.Minecraft_1_20_3), m(0x4B, version.Minecraft_1_20_5), + m(0x50, version.Minecraft_1_21_2), ) Play.ClientBound.Register(&config.StartUpdate{}, m(0x65, version.Minecraft_1_20_2), m(0x67, version.Minecraft_1_20_3), m(0x69, version.Minecraft_1_20_5), + m(0x70, version.Minecraft_1_21_2), ) // For now, we do not process the BundleDelimiter packet on the proxy (therefore the BundleDelimiterHandler is inactive code), // as there are many, many such 0x00 packets and resourcepack request only has one resource pack for us @@ -535,9 +559,11 @@ func init() { //) Play.ClientBound.Register(&p.Transfer{}, m(0x73, version.Minecraft_1_20_5), + m(0x7A, version.Minecraft_1_21_2), ) Play.ClientBound.Register(&p.CustomReportDetails{}, m(0x7A, version.Minecraft_1_21), + m(0x81, version.Minecraft_1_21_2), ) Play.ClientBound.Register(&p.ServerLinks{}, m(0x7B, version.Minecraft_1_21), diff --git a/pkg/edition/java/proto/util/nbt.go b/pkg/edition/java/proto/util/nbt.go index 94ac2663..28b23ad1 100644 --- a/pkg/edition/java/proto/util/nbt.go +++ b/pkg/edition/java/proto/util/nbt.go @@ -3,10 +3,12 @@ package util import ( "bytes" "fmt" + "io" + "github.com/Tnze/go-mc/nbt" + "go.minekube.com/gate/pkg/edition/java/proto/version" "go.minekube.com/gate/pkg/gate/proto" - "io" ) type ( diff --git a/pkg/edition/java/proto/version/version.go b/pkg/edition/java/proto/version/version.go index e03d4c08..9a667e89 100644 --- a/pkg/edition/java/proto/version/version.go +++ b/pkg/edition/java/proto/version/version.go @@ -45,6 +45,7 @@ var ( Minecraft_1_20_3 = v(765, "1.20.3", "1.20.4") Minecraft_1_20_5 = v(766, "1.20.5", "1.20.6") Minecraft_1_21 = v(767, "1.21", "1.21.1") + Minecraft_1_21_2 = v(768, "1.21.2", "1.21.3") // Versions ordered from lowest to highest Versions = []*proto.Version{ @@ -64,7 +65,7 @@ var ( Minecraft_1_18, Minecraft_1_18_2, Minecraft_1_19, Minecraft_1_19_1, Minecraft_1_19_3, Minecraft_1_19_4, Minecraft_1_20, Minecraft_1_20_2, Minecraft_1_20_3, Minecraft_1_20_5, - Minecraft_1_21, + Minecraft_1_21, Minecraft_1_21_2, } ) diff --git a/pkg/edition/java/proxy/events.go b/pkg/edition/java/proxy/events.go index 76b4792a..8b77bc67 100644 --- a/pkg/edition/java/proxy/events.go +++ b/pkg/edition/java/proxy/events.go @@ -1,12 +1,14 @@ package proxy import ( + "net" + "go.minekube.com/gate/pkg/edition/java/proxy/internal/resourcepack" "go.minekube.com/gate/pkg/util/uuid" - "net" "go.minekube.com/brigodier" "go.minekube.com/common/minecraft/component" + "go.minekube.com/gate/pkg/command" "go.minekube.com/gate/pkg/edition/java/forge/modinfo" "go.minekube.com/gate/pkg/edition/java/ping" @@ -603,14 +605,14 @@ func (e *KickedFromServerEvent) KickedDuringServerConnect() bool { return e.duringServerConnect } -// KickedDuringServerConnect returns current kick result. +// Result returns current kick result. // The proxy sets a default non-nil result but an event handler // may has set it nil when handling the event. func (e *KickedFromServerEvent) Result() ServerKickResult { return e.result } -// KickedDuringServerConnect sets the kick result. +// SetResult sets the kick result. func (e *KickedFromServerEvent) SetResult(result ServerKickResult) { e.result = result } @@ -812,6 +814,7 @@ func (c *PlayerChatEvent) Original() string { } // SetAllowed sets whether the chat message is allowed. +// Deprecated: for 1.19.1 and newer, set this as denied will kick users. func (c *PlayerChatEvent) SetAllowed(allowed bool) { c.denied = !allowed } diff --git a/pkg/edition/java/proxy/player.go b/pkg/edition/java/proxy/player.go index e9b99989..31507ea1 100644 --- a/pkg/edition/java/proxy/player.go +++ b/pkg/edition/java/proxy/player.go @@ -4,7 +4,14 @@ import ( "encoding/json" "errors" "fmt" + "net" + "strconv" + "strings" + "sync" + "time" + "github.com/robinbraemer/event" + cfgpacket "go.minekube.com/gate/pkg/edition/java/proto/packet/config" "go.minekube.com/gate/pkg/edition/java/proto/state" "go.minekube.com/gate/pkg/edition/java/proto/state/states" @@ -12,15 +19,12 @@ import ( "go.minekube.com/gate/pkg/gate/proto" "go.minekube.com/gate/pkg/internal/future" "go.minekube.com/gate/pkg/util/netutil" - "net" - "strconv" - "strings" - "sync" - "time" "github.com/go-logr/logr" "go.minekube.com/common/minecraft/component" "go.minekube.com/common/minecraft/component/codec/legacy" + "go.uber.org/atomic" + "go.minekube.com/gate/pkg/edition/java/config" "go.minekube.com/gate/pkg/edition/java/forge/modinfo" "go.minekube.com/gate/pkg/edition/java/netmc" @@ -29,7 +33,6 @@ import ( "go.minekube.com/gate/pkg/edition/java/proxy/phase" "go.minekube.com/gate/pkg/edition/java/proxy/tablist" internaltablist "go.minekube.com/gate/pkg/internal/tablist" - "go.uber.org/atomic" "go.minekube.com/gate/pkg/command" "go.minekube.com/gate/pkg/edition/java/profile" diff --git a/pkg/edition/java/proxy/player/settings.go b/pkg/edition/java/proxy/player/settings.go index 23cd6382..f9efa04f 100644 --- a/pkg/edition/java/proxy/player/settings.go +++ b/pkg/edition/java/proxy/player/settings.go @@ -1,9 +1,11 @@ package player import ( - "go.minekube.com/gate/pkg/edition/java/proto/packet" - "golang.org/x/text/language" "strings" + + "golang.org/x/text/language" + + "go.minekube.com/gate/pkg/edition/java/proto/packet" ) // Settings are the client settings the player gave us. @@ -21,16 +23,30 @@ type Settings interface { // // This feature was introduced in 1.18. ClientListing() bool + TextFiltering() bool // Whether the client has text filtering enabled. + ParticleStatus() ParticleStatus // The particle status of the client. } var DefaultSettings = NewSettings(&packet.ClientSettings{ - Locale: "en_US", - ViewDistance: 10, - ChatColors: true, - SkinParts: 127, - MainHand: 1, + Locale: "en_US", + ViewDistance: 2, + ChatVisibility: 0, + ChatColors: true, + SkinParts: 0, + MainHand: 1, + TextFilteringEnabled: false, + ClientListingAllowed: false, + ParticleStatus: int(AllParticleStatus), }) +type ParticleStatus int + +const ( + AllParticleStatus ParticleStatus = iota + DecreasedParticleStatus + MinimalParticleStatus +) + type ChatMode string const ( @@ -100,19 +116,30 @@ func (s *clientSettings) ViewDistance() uint8 { } func (s *clientSettings) ChatMode() ChatMode { - if s.s.ChatVisibility <= 0 || s.s.ChatVisibility > 2 { + switch s.s.ChatVisibility { + case 0: return ShownChatMode - } - if s.s.ChatVisibility == 1 { + case 1: return CommandsOnly + case 2: + return Hidden + default: + return ShownChatMode } - return Hidden } func (s *clientSettings) ChatColors() bool { return s.s.ChatColors } +func (s *clientSettings) TextFiltering() bool { + return s.s.TextFilteringEnabled +} + +func (s *clientSettings) ParticleStatus() ParticleStatus { + return ParticleStatus(s.s.ParticleStatus) +} + func NewSettings(packet *packet.ClientSettings) Settings { return &clientSettings{ s: packet, diff --git a/pkg/edition/java/proxy/session_client_play.go b/pkg/edition/java/proxy/session_client_play.go index 66842d9d..9dbb07e8 100644 --- a/pkg/edition/java/proxy/session_client_play.go +++ b/pkg/edition/java/proxy/session_client_play.go @@ -4,16 +4,19 @@ import ( "context" "errors" "fmt" - "go.minekube.com/gate/pkg/edition/java/proto/packet/config" - "go.minekube.com/gate/pkg/edition/java/proxy/tablist" - "go.minekube.com/gate/pkg/internal/future" "sort" "strings" "sync" "time" + "go.minekube.com/gate/pkg/edition/java/proto/packet/config" + "go.minekube.com/gate/pkg/edition/java/proxy/tablist" + "go.minekube.com/gate/pkg/internal/future" + "github.com/gammazero/deque" "go.minekube.com/common/minecraft/component" + "go.uber.org/atomic" + "go.minekube.com/gate/pkg/edition/java/forge" "go.minekube.com/gate/pkg/edition/java/netmc" "go.minekube.com/gate/pkg/edition/java/proto/packet/bossbar" @@ -21,11 +24,11 @@ import ( "go.minekube.com/gate/pkg/edition/java/proxy/message" "go.minekube.com/gate/pkg/edition/java/proxy/phase" "go.minekube.com/gate/pkg/util/uuid" - "go.uber.org/atomic" "github.com/go-logr/logr" "github.com/robinbraemer/event" + "go.minekube.com/gate/pkg/edition/java/proto/packet" "go.minekube.com/gate/pkg/edition/java/proto/packet/plugin" "go.minekube.com/gate/pkg/edition/java/proto/packet/title" @@ -520,6 +523,7 @@ func respawnFromJoinGame(joinGame *packet.JoinGame) *packet.Respawn { CurrentDimensionData: joinGame.CurrentDimensionData, LastDeathPosition: joinGame.LastDeathPosition, PortalCooldown: joinGame.PortalCooldown, + SeaLevel: joinGame.SeaLevel, } }