Add 1.21.70 support
This commit is contained in:
@@ -27,16 +27,8 @@ func main() {
|
|||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
listener, err := minecraft.ListenConfig{
|
listener, err := minecraft.ListenConfig{
|
||||||
StatusProvider: p,
|
StatusProvider: p,
|
||||||
AcceptedProtocols: []minecraft.Protocol{
|
AcceptedProtocols: legacyver.All(),
|
||||||
legacyver.New766(),
|
|
||||||
legacyver.New748(),
|
|
||||||
legacyver.New729(),
|
|
||||||
legacyver.New712(),
|
|
||||||
legacyver.New686(),
|
|
||||||
legacyver.New685(),
|
|
||||||
legacyver.New671(),
|
|
||||||
},
|
|
||||||
}.Listen("raknet", config.Connection.LocalAddress)
|
}.Listen("raknet", config.Connection.LocalAddress)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
|
|||||||
18
go.mod
18
go.mod
@@ -10,11 +10,11 @@ require (
|
|||||||
github.com/pelletier/go-toml v1.9.5
|
github.com/pelletier/go-toml v1.9.5
|
||||||
github.com/rogpeppe/go-internal v1.13.1
|
github.com/rogpeppe/go-internal v1.13.1
|
||||||
github.com/samber/lo v1.47.0
|
github.com/samber/lo v1.47.0
|
||||||
github.com/sandertv/gophertunnel v1.44.1-0.20250211173944-b0dbda19ad6a
|
github.com/sandertv/gophertunnel v1.45.1-0.20250325213530-4e2b368f13ca
|
||||||
github.com/segmentio/fasthash v1.0.3
|
github.com/segmentio/fasthash v1.0.3
|
||||||
golang.org/x/exp v0.0.0-20241217172543-b2144cdd0a67
|
golang.org/x/exp v0.0.0-20241217172543-b2144cdd0a67
|
||||||
golang.org/x/image v0.21.0
|
golang.org/x/image v0.21.0
|
||||||
golang.org/x/oauth2 v0.26.0
|
golang.org/x/oauth2 v0.28.0
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
@@ -22,13 +22,13 @@ require (
|
|||||||
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
||||||
github.com/df-mc/goleveldb v1.1.9 // indirect
|
github.com/df-mc/goleveldb v1.1.9 // indirect
|
||||||
github.com/go-jose/go-jose/v3 v3.0.3 // indirect
|
github.com/go-jose/go-jose/v3 v3.0.3 // indirect
|
||||||
github.com/go-jose/go-jose/v4 v4.0.4 // indirect
|
github.com/go-jose/go-jose/v4 v4.0.5 // indirect
|
||||||
github.com/golang/snappy v0.0.4 // indirect
|
github.com/golang/snappy v1.0.0 // indirect
|
||||||
github.com/klauspost/compress v1.17.11 // indirect
|
github.com/klauspost/compress v1.18.0 // indirect
|
||||||
github.com/muhammadmuzzammil1998/jsonc v1.0.0 // indirect
|
github.com/muhammadmuzzammil1998/jsonc v1.0.0 // indirect
|
||||||
github.com/sandertv/go-raknet v1.14.2 // indirect
|
github.com/sandertv/go-raknet v1.14.3-0.20250305181847-6af3e95113d6 // indirect
|
||||||
golang.org/x/crypto v0.33.0 // indirect
|
golang.org/x/crypto v0.36.0 // indirect
|
||||||
golang.org/x/mod v0.22.0 // indirect
|
golang.org/x/mod v0.22.0 // indirect
|
||||||
golang.org/x/net v0.35.0 // indirect
|
golang.org/x/net v0.37.0 // indirect
|
||||||
golang.org/x/text v0.22.0 // indirect
|
golang.org/x/text v0.23.0 // indirect
|
||||||
)
|
)
|
||||||
|
|||||||
20
go.sum
20
go.sum
@@ -18,10 +18,14 @@ github.com/go-jose/go-jose/v3 v3.0.3 h1:fFKWeig/irsp7XD2zBxvnmA/XaRWp5V3CBsZXJF7
|
|||||||
github.com/go-jose/go-jose/v3 v3.0.3/go.mod h1:5b+7YgP7ZICgJDBdfjZaIt+H/9L9T/YQrVfLAMboGkQ=
|
github.com/go-jose/go-jose/v3 v3.0.3/go.mod h1:5b+7YgP7ZICgJDBdfjZaIt+H/9L9T/YQrVfLAMboGkQ=
|
||||||
github.com/go-jose/go-jose/v4 v4.0.4 h1:VsjPI33J0SB9vQM6PLmNjoHqMQNGPiZ0rHL7Ni7Q6/E=
|
github.com/go-jose/go-jose/v4 v4.0.4 h1:VsjPI33J0SB9vQM6PLmNjoHqMQNGPiZ0rHL7Ni7Q6/E=
|
||||||
github.com/go-jose/go-jose/v4 v4.0.4/go.mod h1:NKb5HO1EZccyMpiZNbdUw/14tiXNyUJh188dfnMCAfc=
|
github.com/go-jose/go-jose/v4 v4.0.4/go.mod h1:NKb5HO1EZccyMpiZNbdUw/14tiXNyUJh188dfnMCAfc=
|
||||||
|
github.com/go-jose/go-jose/v4 v4.0.5 h1:M6T8+mKZl/+fNNuFHvGIzDz7BTLQPIounk/b9dw3AaE=
|
||||||
|
github.com/go-jose/go-jose/v4 v4.0.5/go.mod h1:s3P1lRrkT8igV8D9OjyL4WRyHvjB6a4JSllnOrmmBOA=
|
||||||
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||||
github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||||
github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM=
|
github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM=
|
||||||
github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||||
|
github.com/golang/snappy v1.0.0 h1:Oy607GVXHs7RtbggtPBnr2RmDArIsAefDwvrdWvRhGs=
|
||||||
|
github.com/golang/snappy v1.0.0/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||||
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||||
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||||
@@ -29,6 +33,8 @@ github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpO
|
|||||||
github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk=
|
github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk=
|
||||||
github.com/klauspost/compress v1.17.11 h1:In6xLpyWOi1+C7tXUUWv2ot1QvBjxevKAaI6IXrJmUc=
|
github.com/klauspost/compress v1.17.11 h1:In6xLpyWOi1+C7tXUUWv2ot1QvBjxevKAaI6IXrJmUc=
|
||||||
github.com/klauspost/compress v1.17.11/go.mod h1:pMDklpSncoRMuLFrf1W9Ss9KT+0rH90U12bZKk7uwG0=
|
github.com/klauspost/compress v1.17.11/go.mod h1:pMDklpSncoRMuLFrf1W9Ss9KT+0rH90U12bZKk7uwG0=
|
||||||
|
github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo=
|
||||||
|
github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ=
|
||||||
github.com/muhammadmuzzammil1998/jsonc v1.0.0 h1:8o5gBQn4ZA3NBA9DlTujCj2a4w0tqWrPVjDwhzkgTIs=
|
github.com/muhammadmuzzammil1998/jsonc v1.0.0 h1:8o5gBQn4ZA3NBA9DlTujCj2a4w0tqWrPVjDwhzkgTIs=
|
||||||
github.com/muhammadmuzzammil1998/jsonc v1.0.0/go.mod h1:saF2fIVw4banK0H4+/EuqfFLpRnoy5S+ECwTOCcRcSU=
|
github.com/muhammadmuzzammil1998/jsonc v1.0.0/go.mod h1:saF2fIVw4banK0H4+/EuqfFLpRnoy5S+ECwTOCcRcSU=
|
||||||
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||||
@@ -43,6 +49,8 @@ github.com/samber/lo v1.47.0 h1:z7RynLwP5nbyRscyvcD043DWYoOcYRv3mV8lBeqOCLc=
|
|||||||
github.com/samber/lo v1.47.0/go.mod h1:RmDH9Ct32Qy3gduHQuKJ3gW1fMHAnE/fAzQuf6He5cU=
|
github.com/samber/lo v1.47.0/go.mod h1:RmDH9Ct32Qy3gduHQuKJ3gW1fMHAnE/fAzQuf6He5cU=
|
||||||
github.com/sandertv/go-raknet v1.14.2 h1:UZLyHn5yQU2Dq2GVq/LlxwAUikaq4q4AA1rl/Pf3AXQ=
|
github.com/sandertv/go-raknet v1.14.2 h1:UZLyHn5yQU2Dq2GVq/LlxwAUikaq4q4AA1rl/Pf3AXQ=
|
||||||
github.com/sandertv/go-raknet v1.14.2/go.mod h1:/yysjwfCXm2+2OY8mBazLzcxJ3irnylKCyG3FLgUPVU=
|
github.com/sandertv/go-raknet v1.14.2/go.mod h1:/yysjwfCXm2+2OY8mBazLzcxJ3irnylKCyG3FLgUPVU=
|
||||||
|
github.com/sandertv/go-raknet v1.14.3-0.20250305181847-6af3e95113d6 h1:ZfK7NCzIDE+dzp5x6NIO4JDLsjsOxi762CNR1Obds2Q=
|
||||||
|
github.com/sandertv/go-raknet v1.14.3-0.20250305181847-6af3e95113d6/go.mod h1:/yysjwfCXm2+2OY8mBazLzcxJ3irnylKCyG3FLgUPVU=
|
||||||
github.com/sandertv/gophertunnel v1.43.0 h1:zoB0nngGXokBlj+ge4ISvbInEd/1xbrIlclC/POCTgc=
|
github.com/sandertv/gophertunnel v1.43.0 h1:zoB0nngGXokBlj+ge4ISvbInEd/1xbrIlclC/POCTgc=
|
||||||
github.com/sandertv/gophertunnel v1.43.0/go.mod h1:krvLSeRUNQ2iEYJNEgzrKtWO8W5ybZxN5lFfSCkHoNk=
|
github.com/sandertv/gophertunnel v1.43.0/go.mod h1:krvLSeRUNQ2iEYJNEgzrKtWO8W5ybZxN5lFfSCkHoNk=
|
||||||
github.com/sandertv/gophertunnel v1.43.1-0.20241229203958-5af8736ae319 h1:yxDqIvO9BkUFtK2SpnngPDnPQ9hnhq3IGZ6qiO2rFHg=
|
github.com/sandertv/gophertunnel v1.43.1-0.20241229203958-5af8736ae319 h1:yxDqIvO9BkUFtK2SpnngPDnPQ9hnhq3IGZ6qiO2rFHg=
|
||||||
@@ -53,6 +61,10 @@ github.com/sandertv/gophertunnel v1.43.2-0.20250207144337-b2857453171d h1:JK3btK
|
|||||||
github.com/sandertv/gophertunnel v1.43.2-0.20250207144337-b2857453171d/go.mod h1:XuEJo+ARim+NKiD90Z56sQRcDtCOErz26e2bt3LEd9I=
|
github.com/sandertv/gophertunnel v1.43.2-0.20250207144337-b2857453171d/go.mod h1:XuEJo+ARim+NKiD90Z56sQRcDtCOErz26e2bt3LEd9I=
|
||||||
github.com/sandertv/gophertunnel v1.44.1-0.20250211173944-b0dbda19ad6a h1:1dFrVCwemoApT79gWY0PMjMTjZooS553YNRvml6IA2Y=
|
github.com/sandertv/gophertunnel v1.44.1-0.20250211173944-b0dbda19ad6a h1:1dFrVCwemoApT79gWY0PMjMTjZooS553YNRvml6IA2Y=
|
||||||
github.com/sandertv/gophertunnel v1.44.1-0.20250211173944-b0dbda19ad6a/go.mod h1:XuEJo+ARim+NKiD90Z56sQRcDtCOErz26e2bt3LEd9I=
|
github.com/sandertv/gophertunnel v1.44.1-0.20250211173944-b0dbda19ad6a/go.mod h1:XuEJo+ARim+NKiD90Z56sQRcDtCOErz26e2bt3LEd9I=
|
||||||
|
github.com/sandertv/gophertunnel v1.45.0 h1:bnOUbQWK8Hj26Q0rb5Ic+skjERV/G/Ao2lSQhJ3KZXY=
|
||||||
|
github.com/sandertv/gophertunnel v1.45.0/go.mod h1:lvzOdyb2fkoo3uySe++hy4UKq0I649oUFJKkro2ZHpY=
|
||||||
|
github.com/sandertv/gophertunnel v1.45.1-0.20250325213530-4e2b368f13ca h1:sFNeEFdO2U88+C8GRWchDb7ziTnTPRTv02dN5BHWopo=
|
||||||
|
github.com/sandertv/gophertunnel v1.45.1-0.20250325213530-4e2b368f13ca/go.mod h1:lvzOdyb2fkoo3uySe++hy4UKq0I649oUFJKkro2ZHpY=
|
||||||
github.com/segmentio/fasthash v1.0.3 h1:EI9+KE1EwvMLBWwjpRDc+fEM+prwxDYbslddQGtrmhM=
|
github.com/segmentio/fasthash v1.0.3 h1:EI9+KE1EwvMLBWwjpRDc+fEM+prwxDYbslddQGtrmhM=
|
||||||
github.com/segmentio/fasthash v1.0.3/go.mod h1:waKX8l2N8yckOgmSsXJi7x1ZfdKZ4x7KRMzBtS3oedY=
|
github.com/segmentio/fasthash v1.0.3/go.mod h1:waKX8l2N8yckOgmSsXJi7x1ZfdKZ4x7KRMzBtS3oedY=
|
||||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
@@ -67,6 +79,8 @@ golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U=
|
|||||||
golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk=
|
golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk=
|
||||||
golang.org/x/crypto v0.33.0 h1:IOBPskki6Lysi0lo9qQvbxiQ+FvsCC/YWOecCHAixus=
|
golang.org/x/crypto v0.33.0 h1:IOBPskki6Lysi0lo9qQvbxiQ+FvsCC/YWOecCHAixus=
|
||||||
golang.org/x/crypto v0.33.0/go.mod h1:bVdXmD7IV/4GdElGPozy6U7lWdRXA4qyRVGJV57uQ5M=
|
golang.org/x/crypto v0.33.0/go.mod h1:bVdXmD7IV/4GdElGPozy6U7lWdRXA4qyRVGJV57uQ5M=
|
||||||
|
golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34=
|
||||||
|
golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc=
|
||||||
golang.org/x/exp v0.0.0-20241217172543-b2144cdd0a67 h1:1UoZQm6f0P/ZO0w1Ri+f+ifG/gXhegadRdwBIXEFWDo=
|
golang.org/x/exp v0.0.0-20241217172543-b2144cdd0a67 h1:1UoZQm6f0P/ZO0w1Ri+f+ifG/gXhegadRdwBIXEFWDo=
|
||||||
golang.org/x/exp v0.0.0-20241217172543-b2144cdd0a67/go.mod h1:qj5a5QZpwLU2NLQudwIN5koi3beDhSAlJwa67PuM98c=
|
golang.org/x/exp v0.0.0-20241217172543-b2144cdd0a67/go.mod h1:qj5a5QZpwLU2NLQudwIN5koi3beDhSAlJwa67PuM98c=
|
||||||
golang.org/x/image v0.0.0-20190321063152-3fc05d484e9f/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
|
golang.org/x/image v0.0.0-20190321063152-3fc05d484e9f/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
|
||||||
@@ -90,12 +104,16 @@ golang.org/x/net v0.34.0 h1:Mb7Mrk043xzHgnRM88suvJFwzVrRfHEHJEl5/71CKw0=
|
|||||||
golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k=
|
golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k=
|
||||||
golang.org/x/net v0.35.0 h1:T5GQRQb2y08kTAByq9L4/bz8cipCdA8FbRTXewonqY8=
|
golang.org/x/net v0.35.0 h1:T5GQRQb2y08kTAByq9L4/bz8cipCdA8FbRTXewonqY8=
|
||||||
golang.org/x/net v0.35.0/go.mod h1:EglIi67kWsHKlRzzVMUD93VMSWGFOMSZgxFjparz1Qk=
|
golang.org/x/net v0.35.0/go.mod h1:EglIi67kWsHKlRzzVMUD93VMSWGFOMSZgxFjparz1Qk=
|
||||||
|
golang.org/x/net v0.37.0 h1:1zLorHbz+LYj7MQlSf1+2tPIIgibq2eL5xkrGk6f+2c=
|
||||||
|
golang.org/x/net v0.37.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8=
|
||||||
golang.org/x/oauth2 v0.23.0 h1:PbgcYx2W7i4LvjJWEbf0ngHV6qJYr86PkAV3bXdLEbs=
|
golang.org/x/oauth2 v0.23.0 h1:PbgcYx2W7i4LvjJWEbf0ngHV6qJYr86PkAV3bXdLEbs=
|
||||||
golang.org/x/oauth2 v0.23.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
|
golang.org/x/oauth2 v0.23.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
|
||||||
golang.org/x/oauth2 v0.24.0 h1:KTBBxWqUa0ykRPLtV69rRto9TLXcqYkeswu48x/gvNE=
|
golang.org/x/oauth2 v0.24.0 h1:KTBBxWqUa0ykRPLtV69rRto9TLXcqYkeswu48x/gvNE=
|
||||||
golang.org/x/oauth2 v0.24.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
|
golang.org/x/oauth2 v0.24.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
|
||||||
golang.org/x/oauth2 v0.26.0 h1:afQXWNNaeC4nvZ0Ed9XvCCzXM6UHJG7iCg0W4fPqSBE=
|
golang.org/x/oauth2 v0.26.0 h1:afQXWNNaeC4nvZ0Ed9XvCCzXM6UHJG7iCg0W4fPqSBE=
|
||||||
golang.org/x/oauth2 v0.26.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
|
golang.org/x/oauth2 v0.26.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
|
||||||
|
golang.org/x/oauth2 v0.28.0 h1:CrgCKl8PPAVtLnU3c+EDw6x11699EWlsDeWNWKdIOkc=
|
||||||
|
golang.org/x/oauth2 v0.28.0/go.mod h1:onh5ek6nERTohokkhCD/y2cV4Do3fxFHFuAejCkRWT8=
|
||||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
@@ -126,6 +144,8 @@ golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo=
|
|||||||
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
|
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
|
||||||
golang.org/x/text v0.22.0 h1:bofq7m3/HAFvbF51jz3Q9wLg3jkvSPuiZu/pD1XwgtM=
|
golang.org/x/text v0.22.0 h1:bofq7m3/HAFvbF51jz3Q9wLg3jkvSPuiZu/pD1XwgtM=
|
||||||
golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY=
|
golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY=
|
||||||
|
golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY=
|
||||||
|
golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4=
|
||||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||||
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
||||||
|
|||||||
17
legacyver/all.go
Normal file
17
legacyver/all.go
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
package legacyver
|
||||||
|
|
||||||
|
import "github.com/sandertv/gophertunnel/minecraft"
|
||||||
|
|
||||||
|
// All returns a slice of all legacy protocol versions that are supported.
|
||||||
|
func All() []minecraft.Protocol {
|
||||||
|
return []minecraft.Protocol{
|
||||||
|
New776(),
|
||||||
|
New766(),
|
||||||
|
New748(),
|
||||||
|
New729(),
|
||||||
|
New712(),
|
||||||
|
New686(),
|
||||||
|
New685(),
|
||||||
|
New671(),
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
legacyver/data/block_states_786.nbt
Normal file
BIN
legacyver/data/block_states_786.nbt
Normal file
Binary file not shown.
BIN
legacyver/data/item_runtime_ids_786.nbt
Normal file
BIN
legacyver/data/item_runtime_ids_786.nbt
Normal file
Binary file not shown.
9061
legacyver/data/required_item_list_786.json
Normal file
9061
legacyver/data/required_item_list_786.json
Normal file
File diff suppressed because it is too large
Load Diff
@@ -520,7 +520,7 @@ func (t *DefaultItemTranslator) DowngradeLegacyItemRegistry(entries []proto.Lega
|
|||||||
panic(itemType)
|
panic(itemType)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
t.latest.RegisterEntryRID(entry.Name, int32(entry.RuntimeID), 2)
|
t.latest.RegisterEntryRID(entry.Name, int32(entry.RuntimeID), 2, nil)
|
||||||
entry.RuntimeID = int16(t.mapping.RegisterEntry(entry.Name))
|
entry.RuntimeID = int16(t.mapping.RegisterEntry(entry.Name))
|
||||||
}
|
}
|
||||||
entries[i] = entry
|
entries[i] = entry
|
||||||
@@ -550,7 +550,7 @@ func (t *DefaultItemTranslator) UpgradeLegacyItemRegistry(entries []proto.Legacy
|
|||||||
panic(itemType)
|
panic(itemType)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
t.latest.RegisterEntryRID(entry.Name, int32(entry.RuntimeID), 2)
|
t.latest.RegisterEntryRID(entry.Name, int32(entry.RuntimeID), 2, nil)
|
||||||
entry.RuntimeID = int16(t.mapping.RegisterEntry(entry.Name))
|
entry.RuntimeID = int16(t.mapping.RegisterEntry(entry.Name))
|
||||||
}
|
}
|
||||||
entries[i] = entry
|
entries[i] = entry
|
||||||
@@ -583,8 +583,16 @@ func (t *DefaultItemTranslator) DowngradeItemEntries(entries []proto.ItemEntry)
|
|||||||
if entry.Name, ok = t.mapping.ItemRuntimeIDToName(int32(entry.RuntimeID)); !ok {
|
if entry.Name, ok = t.mapping.ItemRuntimeIDToName(int32(entry.RuntimeID)); !ok {
|
||||||
panic(entry)
|
panic(entry)
|
||||||
}
|
}
|
||||||
|
entryVer, ok := t.mapping.ItemRuntimeIDToVersion(int32(entry.RuntimeID))
|
||||||
|
if ok {
|
||||||
|
entry.Version = int32(entryVer)
|
||||||
|
}
|
||||||
|
entryData, ok := t.mapping.ItemRuntimeIDToData(int32(entry.RuntimeID))
|
||||||
|
if ok {
|
||||||
|
entry.Data = entryData
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
t.latest.RegisterEntryRID(entry.Name, int32(entry.RuntimeID), 2)
|
t.latest.RegisterEntryRID(entry.Name, int32(entry.RuntimeID), 2, entry.Data)
|
||||||
entry.RuntimeID = int16(t.mapping.RegisterEntry(entry.Name))
|
entry.RuntimeID = int16(t.mapping.RegisterEntry(entry.Name))
|
||||||
}
|
}
|
||||||
entries[i] = entry
|
entries[i] = entry
|
||||||
@@ -613,8 +621,18 @@ func (t *DefaultItemTranslator) UpgradeItemEntries(entries []proto.ItemEntry) []
|
|||||||
if entry.Name, ok = t.latest.ItemRuntimeIDToName(int32(entry.RuntimeID)); !ok {
|
if entry.Name, ok = t.latest.ItemRuntimeIDToName(int32(entry.RuntimeID)); !ok {
|
||||||
panic(entry)
|
panic(entry)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
entryVer, ok := t.mapping.ItemRuntimeIDToVersion(int32(entry.RuntimeID))
|
||||||
|
if ok {
|
||||||
|
entry.Version = int32(entryVer)
|
||||||
|
}
|
||||||
|
|
||||||
|
entryData, ok := t.mapping.ItemRuntimeIDToData(int32(entry.RuntimeID))
|
||||||
|
if ok {
|
||||||
|
entry.Data = entryData
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
t.latest.RegisterEntryRID(entry.Name, int32(entry.RuntimeID), 2)
|
t.latest.RegisterEntryRID(entry.Name, int32(entry.RuntimeID), 2, entry.Data)
|
||||||
entry.RuntimeID = int16(t.mapping.RegisterEntry(entry.Name))
|
entry.RuntimeID = int16(t.mapping.RegisterEntry(entry.Name))
|
||||||
}
|
}
|
||||||
entries[i] = entry
|
entries[i] = entry
|
||||||
|
|||||||
66
legacyver/legacypacket/client_movement_prediction_sync.go
Normal file
66
legacyver/legacypacket/client_movement_prediction_sync.go
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
package legacypacket
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/akmalfairuz/legacy-version/legacyver/proto"
|
||||||
|
"github.com/sandertv/gophertunnel/minecraft/protocol"
|
||||||
|
"github.com/sandertv/gophertunnel/minecraft/protocol/packet"
|
||||||
|
)
|
||||||
|
|
||||||
|
const ClientMovementPredictionSyncBitsetSize = 123
|
||||||
|
|
||||||
|
// ClientMovementPredictionSync is sent by the client to the server periodically if the client has received
|
||||||
|
// movement corrections from the server, containing information about client-predictions that are relevant
|
||||||
|
// to movement.
|
||||||
|
type ClientMovementPredictionSync struct {
|
||||||
|
// ActorFlags is a bitset of all the flags that are currently set for the client.
|
||||||
|
ActorFlags protocol.Bitset
|
||||||
|
// BoundingBoxScale is the scale of the client's bounding box.
|
||||||
|
BoundingBoxScale float32
|
||||||
|
// BoundingBoxWidth is the width of the client's bounding box.
|
||||||
|
BoundingBoxWidth float32
|
||||||
|
// BoundingBoxHeight is the height of the client's bounding box.
|
||||||
|
BoundingBoxHeight float32
|
||||||
|
// MovementSpeed is the movement speed attribute or 0 if not set.
|
||||||
|
MovementSpeed float32
|
||||||
|
// UnderwaterMovementSpeed is the underwater movement speed attribute or 0 if not set.
|
||||||
|
UnderwaterMovementSpeed float32
|
||||||
|
// LavaMovementSpeed is the lava movement speed attribute or 0 if not set.
|
||||||
|
LavaMovementSpeed float32
|
||||||
|
// JumpStrength is the jump strength attribute or 0 if not set.
|
||||||
|
JumpStrength float32
|
||||||
|
// Health is the health attribute or 0 if not set.
|
||||||
|
Health float32
|
||||||
|
// Hunger is the hunger attribute or 0 if not set.
|
||||||
|
Hunger float32
|
||||||
|
// EntityUniqueID is the unique ID of the entity. The unique ID is a value that remains consistent across
|
||||||
|
// different sessions of the same world.
|
||||||
|
EntityUniqueID int64
|
||||||
|
// Flying specifies if the client is currently flying.
|
||||||
|
Flying bool
|
||||||
|
}
|
||||||
|
|
||||||
|
// ID ...
|
||||||
|
func (*ClientMovementPredictionSync) ID() uint32 {
|
||||||
|
return packet.IDClientMovementPredictionSync
|
||||||
|
}
|
||||||
|
|
||||||
|
func (pk *ClientMovementPredictionSync) Marshal(io protocol.IO) {
|
||||||
|
if proto.IsProtoGTE(io, proto.ID786) {
|
||||||
|
io.Bitset(&pk.ActorFlags, ClientMovementPredictionSyncBitsetSize)
|
||||||
|
} else {
|
||||||
|
io.Bitset(&pk.ActorFlags, 120)
|
||||||
|
}
|
||||||
|
io.Float32(&pk.BoundingBoxScale)
|
||||||
|
io.Float32(&pk.BoundingBoxWidth)
|
||||||
|
io.Float32(&pk.BoundingBoxHeight)
|
||||||
|
io.Float32(&pk.MovementSpeed)
|
||||||
|
io.Float32(&pk.UnderwaterMovementSpeed)
|
||||||
|
io.Float32(&pk.LavaMovementSpeed)
|
||||||
|
io.Float32(&pk.JumpStrength)
|
||||||
|
io.Float32(&pk.Health)
|
||||||
|
io.Float32(&pk.Hunger)
|
||||||
|
io.Varint64(&pk.EntityUniqueID)
|
||||||
|
if proto.IsProtoGTE(io, proto.ID786) {
|
||||||
|
io.Bool(&pk.Flying)
|
||||||
|
}
|
||||||
|
}
|
||||||
55
legacyver/legacypacket/level_sound_event.go
Normal file
55
legacyver/legacypacket/level_sound_event.go
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
package legacypacket
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/akmalfairuz/legacy-version/legacyver/proto"
|
||||||
|
"github.com/go-gl/mathgl/mgl32"
|
||||||
|
"github.com/sandertv/gophertunnel/minecraft/protocol"
|
||||||
|
"github.com/sandertv/gophertunnel/minecraft/protocol/packet"
|
||||||
|
)
|
||||||
|
|
||||||
|
// LevelSoundEvent is sent by the server to make any kind of built-in sound heard to a player. It is sent to,
|
||||||
|
// for example, play a stepping sound or a shear sound. The packet is also sent by the client, in which case
|
||||||
|
// it could be forwarded by the server to the other players online. If possible, the packets from the client
|
||||||
|
// should be ignored however, and the server should play them on its own accord.
|
||||||
|
type LevelSoundEvent struct {
|
||||||
|
// SoundType is the type of the sound to play. It is one of the constants above. Some of the sound types
|
||||||
|
// require additional data, which is set in the EventData field.
|
||||||
|
SoundType uint32
|
||||||
|
// Position is the position of the sound event. The player will be able to hear the direction of the sound
|
||||||
|
// based on what position is sent here.
|
||||||
|
Position mgl32.Vec3
|
||||||
|
// ExtraData is a packed integer that some sound types use to provide extra data. An example of this is
|
||||||
|
// the note sound, which is composed of a pitch and an instrument type.
|
||||||
|
ExtraData int32
|
||||||
|
// EntityType is the string entity type of the entity that emitted the sound, for example
|
||||||
|
// 'minecraft:skeleton'. Some sound types use this entity type for additional data.
|
||||||
|
EntityType string
|
||||||
|
// BabyMob specifies if the sound should be that of a baby mob. It is most notably used for parrot
|
||||||
|
// imitations, which will change based on if this field is set to true or not.
|
||||||
|
BabyMob bool
|
||||||
|
// DisableRelativeVolume specifies if the sound should be played relatively or not. If set to true, the
|
||||||
|
// sound will have full volume, regardless of where the Position is, whereas if set to false, the sound's
|
||||||
|
// volume will be based on the distance to Position.
|
||||||
|
DisableRelativeVolume bool
|
||||||
|
// EntityUniqueID is the unique ID of a source entity. The unique ID is a value that remains consistent across
|
||||||
|
// different sessions of the same world, but most servers simply fill the runtime ID of the entity out for
|
||||||
|
// this field.
|
||||||
|
EntityUniqueID int64
|
||||||
|
}
|
||||||
|
|
||||||
|
// ID ...
|
||||||
|
func (*LevelSoundEvent) ID() uint32 {
|
||||||
|
return packet.IDLevelSoundEvent
|
||||||
|
}
|
||||||
|
|
||||||
|
func (pk *LevelSoundEvent) Marshal(io protocol.IO) {
|
||||||
|
io.Varuint32(&pk.SoundType)
|
||||||
|
io.Vec3(&pk.Position)
|
||||||
|
io.Varint32(&pk.ExtraData)
|
||||||
|
io.String(&pk.EntityType)
|
||||||
|
io.Bool(&pk.BabyMob)
|
||||||
|
io.Bool(&pk.DisableRelativeVolume)
|
||||||
|
if proto.IsProtoGTE(io, proto.ID786) {
|
||||||
|
io.Int64(&pk.EntityUniqueID)
|
||||||
|
}
|
||||||
|
}
|
||||||
45
legacyver/legacypacket/set_hud.go
Normal file
45
legacyver/legacypacket/set_hud.go
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
package legacypacket
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/akmalfairuz/legacy-version/legacyver/proto"
|
||||||
|
"github.com/sandertv/gophertunnel/minecraft/protocol"
|
||||||
|
"github.com/sandertv/gophertunnel/minecraft/protocol/packet"
|
||||||
|
)
|
||||||
|
|
||||||
|
// SetHud is sent by the server to set the visibility of individual HUD elements on the client. It is
|
||||||
|
// important to note that the client does not reset the state of the HUD elements after it leaves a server,
|
||||||
|
// meaning they can leak into sessions on different servers. To be safe, you should reset the visibility of
|
||||||
|
// all HUD elements when a player connects.
|
||||||
|
type SetHud struct {
|
||||||
|
// Elements is a list of HUD elements that are being modified. The values can be any of the HudElement
|
||||||
|
// constants above.
|
||||||
|
Elements []int32
|
||||||
|
// Visibility represents the new visibility of the specified Elements. It can be any of the HudVisibility
|
||||||
|
// constants above.
|
||||||
|
Visibility int32
|
||||||
|
}
|
||||||
|
|
||||||
|
// ID ...
|
||||||
|
func (*SetHud) ID() uint32 {
|
||||||
|
return packet.IDSetHud
|
||||||
|
}
|
||||||
|
|
||||||
|
func (pk *SetHud) Marshal(io protocol.IO) {
|
||||||
|
if proto.IsProtoGTE(io, proto.ID786) {
|
||||||
|
protocol.FuncSlice(io, &pk.Elements, io.Varint32)
|
||||||
|
io.Varint32(&pk.Visibility)
|
||||||
|
} else {
|
||||||
|
elements := make([]uint8, len(pk.Elements))
|
||||||
|
for i, v := range pk.Elements {
|
||||||
|
elements[i] = uint8(v)
|
||||||
|
}
|
||||||
|
protocol.FuncSlice(io, &elements, io.Uint8)
|
||||||
|
for i, v := range elements {
|
||||||
|
pk.Elements[i] = int32(v)
|
||||||
|
}
|
||||||
|
|
||||||
|
visibility := uint8(pk.Visibility)
|
||||||
|
io.Uint8(&visibility)
|
||||||
|
pk.Visibility = int32(visibility)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,6 +3,7 @@ package proto
|
|||||||
import "github.com/sandertv/gophertunnel/minecraft/protocol"
|
import "github.com/sandertv/gophertunnel/minecraft/protocol"
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
ID786 = 786 // v1.21.70
|
||||||
ID776 = 776 // v1.21.60
|
ID776 = 776 // v1.21.60
|
||||||
ID766 = 766 // v1.21.50
|
ID766 = 766 // v1.21.50
|
||||||
ID748 = 748 // v1.21.40
|
ID748 = 748 // v1.21.40
|
||||||
|
|||||||
@@ -106,6 +106,12 @@ func convertPacketFunc(pid uint32, cur func() packet.Packet) func() packet.Packe
|
|||||||
return func() packet.Packet { return &legacypacket.UpdateAbilities{} }
|
return func() packet.Packet { return &legacypacket.UpdateAbilities{} }
|
||||||
case packet.IDClientCheatAbility:
|
case packet.IDClientCheatAbility:
|
||||||
return func() packet.Packet { return &legacypacket.ClientCheatAbility{} }
|
return func() packet.Packet { return &legacypacket.ClientCheatAbility{} }
|
||||||
|
case packet.IDClientMovementPredictionSync:
|
||||||
|
return func() packet.Packet { return &legacypacket.ClientMovementPredictionSync{} }
|
||||||
|
case packet.IDLevelSoundEvent:
|
||||||
|
return func() packet.Packet { return &legacypacket.LevelSoundEvent{} }
|
||||||
|
case packet.IDSetHud:
|
||||||
|
return func() packet.Packet { return &legacypacket.SetHud{} }
|
||||||
default:
|
default:
|
||||||
return cur
|
return cur
|
||||||
}
|
}
|
||||||
@@ -629,6 +635,40 @@ func (p *Protocol) downgradePackets(pks []packet.Packet, conn *minecraft.Conn) [
|
|||||||
}
|
}
|
||||||
case *packet.PlayerSkin:
|
case *packet.PlayerSkin:
|
||||||
pk.Skin.GeometryDataEngineVersion = []byte(p.Ver())
|
pk.Skin.GeometryDataEngineVersion = []byte(p.Ver())
|
||||||
|
case *packet.ClientMovementPredictionSync:
|
||||||
|
actorFlags := pk.ActorFlags
|
||||||
|
if p.ID() < proto.ID786 {
|
||||||
|
actorFlags = fitBitset(actorFlags, 120)
|
||||||
|
}
|
||||||
|
pks[pkIndex] = &legacypacket.ClientMovementPredictionSync{
|
||||||
|
ActorFlags: actorFlags,
|
||||||
|
BoundingBoxScale: pk.BoundingBoxScale,
|
||||||
|
BoundingBoxWidth: pk.BoundingBoxWidth,
|
||||||
|
BoundingBoxHeight: pk.BoundingBoxHeight,
|
||||||
|
MovementSpeed: pk.MovementSpeed,
|
||||||
|
UnderwaterMovementSpeed: pk.UnderwaterMovementSpeed,
|
||||||
|
LavaMovementSpeed: pk.LavaMovementSpeed,
|
||||||
|
JumpStrength: pk.JumpStrength,
|
||||||
|
Health: pk.Health,
|
||||||
|
Hunger: pk.Hunger,
|
||||||
|
EntityUniqueID: pk.EntityUniqueID,
|
||||||
|
Flying: pk.Flying,
|
||||||
|
}
|
||||||
|
case *packet.LevelSoundEvent:
|
||||||
|
pks[pkIndex] = &legacypacket.LevelSoundEvent{
|
||||||
|
SoundType: pk.SoundType,
|
||||||
|
Position: pk.Position,
|
||||||
|
ExtraData: pk.ExtraData,
|
||||||
|
EntityType: pk.EntityType,
|
||||||
|
BabyMob: pk.BabyMob,
|
||||||
|
DisableRelativeVolume: pk.DisableRelativeVolume,
|
||||||
|
EntityUniqueID: pk.EntityUniqueID,
|
||||||
|
}
|
||||||
|
case *packet.SetHud:
|
||||||
|
pks[pkIndex] = &legacypacket.SetHud{
|
||||||
|
Elements: pk.Elements,
|
||||||
|
Visibility: pk.Visibility,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1082,6 +1122,36 @@ func (p *Protocol) upgradePackets(pks []packet.Packet, conn *minecraft.Conn) []p
|
|||||||
}
|
}
|
||||||
case *legacypacket.UpdateAbilities:
|
case *legacypacket.UpdateAbilities:
|
||||||
pks[pkIndex] = &packet.UpdateAbilities{AbilityData: pk.AbilityData.ToLatest()}
|
pks[pkIndex] = &packet.UpdateAbilities{AbilityData: pk.AbilityData.ToLatest()}
|
||||||
|
case *legacypacket.ClientMovementPredictionSync:
|
||||||
|
pks[pkIndex] = &packet.ClientMovementPredictionSync{
|
||||||
|
ActorFlags: fitBitset(pk.ActorFlags, packet.ClientMovementPredictionSyncBitsetSize),
|
||||||
|
BoundingBoxScale: pk.BoundingBoxScale,
|
||||||
|
BoundingBoxWidth: pk.BoundingBoxWidth,
|
||||||
|
BoundingBoxHeight: pk.BoundingBoxHeight,
|
||||||
|
MovementSpeed: pk.MovementSpeed,
|
||||||
|
UnderwaterMovementSpeed: pk.UnderwaterMovementSpeed,
|
||||||
|
LavaMovementSpeed: pk.LavaMovementSpeed,
|
||||||
|
JumpStrength: pk.JumpStrength,
|
||||||
|
Health: pk.Health,
|
||||||
|
Hunger: pk.Hunger,
|
||||||
|
EntityUniqueID: pk.EntityUniqueID,
|
||||||
|
Flying: pk.Flying,
|
||||||
|
}
|
||||||
|
case *legacypacket.LevelSoundEvent:
|
||||||
|
pks[pkIndex] = &packet.LevelSoundEvent{
|
||||||
|
SoundType: pk.SoundType,
|
||||||
|
Position: pk.Position,
|
||||||
|
ExtraData: pk.ExtraData,
|
||||||
|
EntityType: pk.EntityType,
|
||||||
|
BabyMob: pk.BabyMob,
|
||||||
|
DisableRelativeVolume: pk.DisableRelativeVolume,
|
||||||
|
EntityUniqueID: pk.EntityUniqueID,
|
||||||
|
}
|
||||||
|
case *legacypacket.SetHud:
|
||||||
|
pks[pkIndex] = &packet.SetHud{
|
||||||
|
Elements: pk.Elements,
|
||||||
|
Visibility: pk.Visibility,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return pks
|
return pks
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ package legacyver
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
_ "embed"
|
_ "embed"
|
||||||
|
"github.com/akmalfairuz/legacy-version/internal/chunk"
|
||||||
|
"github.com/akmalfairuz/legacy-version/legacyver/proto"
|
||||||
"github.com/akmalfairuz/legacy-version/mapping"
|
"github.com/akmalfairuz/legacy-version/mapping"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -20,6 +22,15 @@ var (
|
|||||||
//go:embed data/block_states_776.nbt
|
//go:embed data/block_states_776.nbt
|
||||||
blockStateData776 []byte
|
blockStateData776 []byte
|
||||||
|
|
||||||
itemMappingLatest = mapping.NewItemMapping(itemRuntimeIDData776, requiredItemList776, ItemVersion776, false)
|
itemMapping776 = mapping.NewItemMapping(itemRuntimeIDData776, requiredItemList776, ItemVersion776, false)
|
||||||
blockMappingLatest = mapping.NewBlockMapping(blockStateData776)
|
blockMapping776 = mapping.NewBlockMapping(blockStateData776)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func New776() *Protocol {
|
||||||
|
return &Protocol{
|
||||||
|
ver: "1.21.60",
|
||||||
|
id: proto.ID776,
|
||||||
|
blockTranslator: NewBlockTranslator(blockMapping776, blockMappingLatest, chunk.NewNetworkPersistentEncoding(blockMapping776, BlockVersion776), chunk.NewBlockPaletteEncoding(blockMapping776, BlockVersion776), false),
|
||||||
|
itemTranslator: NewItemTranslator(itemMapping776, itemMappingLatest, blockMapping776, blockMappingLatest),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
25
legacyver/v786.go
Normal file
25
legacyver/v786.go
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
package legacyver
|
||||||
|
|
||||||
|
import (
|
||||||
|
_ "embed"
|
||||||
|
"github.com/akmalfairuz/legacy-version/mapping"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// ItemVersion786 ...
|
||||||
|
ItemVersion786 = 241
|
||||||
|
// BlockVersion786 ...
|
||||||
|
BlockVersion786 int32 = (1 << 24) | (21 << 16) | (70 << 8)
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
//go:embed data/item_runtime_ids_786.nbt
|
||||||
|
itemRuntimeIDData786 []byte
|
||||||
|
//go:embed data/required_item_list_786.json
|
||||||
|
requiredItemList786 []byte
|
||||||
|
//go:embed data/block_states_786.nbt
|
||||||
|
blockStateData786 []byte
|
||||||
|
|
||||||
|
itemMappingLatest = mapping.NewItemMapping(itemRuntimeIDData786, requiredItemList786, ItemVersion786, false)
|
||||||
|
blockMappingLatest = mapping.NewBlockMapping(blockStateData786)
|
||||||
|
)
|
||||||
@@ -11,8 +11,12 @@ type Item interface {
|
|||||||
ItemRuntimeIDToName(int32) (string, bool)
|
ItemRuntimeIDToName(int32) (string, bool)
|
||||||
// ItemNameToRuntimeID converts a string ID to an item runtime ID.
|
// ItemNameToRuntimeID converts a string ID to an item runtime ID.
|
||||||
ItemNameToRuntimeID(string) (int32, bool)
|
ItemNameToRuntimeID(string) (int32, bool)
|
||||||
|
// ItemRuntimeIDToVersion converts an item runtime ID to its version.
|
||||||
|
ItemRuntimeIDToVersion(int32) (uint8, bool)
|
||||||
|
// ItemRuntimeIDToData converts an item runtime ID to its data.
|
||||||
|
ItemRuntimeIDToData(int32) (map[string]any, bool)
|
||||||
RegisterEntry(string) int32
|
RegisterEntry(string) int32
|
||||||
RegisterEntryRID(string, int32, uint8)
|
RegisterEntryRID(string, int32, uint8, map[string]any)
|
||||||
Air() int32
|
Air() int32
|
||||||
ItemVersion() uint16
|
ItemVersion() uint16
|
||||||
}
|
}
|
||||||
@@ -25,14 +29,17 @@ type DefaultItemMapping struct {
|
|||||||
itemNamesToRuntimeIDs map[string]int32
|
itemNamesToRuntimeIDs map[string]int32
|
||||||
// itemRuntimeIDToVersion holds a map to translate item runtime IDs to versions.
|
// itemRuntimeIDToVersion holds a map to translate item runtime IDs to versions.
|
||||||
itemRuntimeIDToVersion map[int32]uint8
|
itemRuntimeIDToVersion map[int32]uint8
|
||||||
airRID int32
|
// itemRuntimeIDToData holds a map to translate item runtime IDs to data.
|
||||||
itemVersion uint16
|
itemRuntimeIDToData map[int32]map[string]any
|
||||||
|
airRID int32
|
||||||
|
itemVersion uint16
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewItemMapping(itemRuntimeIDData []byte, requiredItemList []byte, itemVersion uint16, direct bool) *DefaultItemMapping {
|
func NewItemMapping(itemRuntimeIDData []byte, requiredItemList []byte, itemVersion uint16, direct bool) *DefaultItemMapping {
|
||||||
itemRuntimeIDsToNames := make(map[int32]string)
|
itemRuntimeIDsToNames := make(map[int32]string)
|
||||||
itemNamesToRuntimeIDs := make(map[string]int32)
|
itemNamesToRuntimeIDs := make(map[string]int32)
|
||||||
itemRuntimeIDToVersion := make(map[int32]uint8)
|
itemRuntimeIDToVersion := make(map[int32]uint8)
|
||||||
|
itemRuntimeIDToData := make(map[int32]map[string]any)
|
||||||
var airRID *int32
|
var airRID *int32
|
||||||
|
|
||||||
if direct {
|
if direct {
|
||||||
@@ -50,9 +57,10 @@ func NewItemMapping(itemRuntimeIDData []byte, requiredItemList []byte, itemVersi
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
var m map[string]struct {
|
var m map[string]struct {
|
||||||
RuntimeID int16 `json:"runtime_id"`
|
RuntimeID int16 `json:"runtime_id"`
|
||||||
ComponentBased bool `json:"component_based"`
|
ComponentBased bool `json:"component_based"`
|
||||||
Version *uint8 `json:"version"`
|
Version *uint8 `json:"version"`
|
||||||
|
Data map[string]any `json:"data,omitempty"`
|
||||||
}
|
}
|
||||||
if err := json.Unmarshal(requiredItemList, &m); err != nil {
|
if err := json.Unmarshal(requiredItemList, &m); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
@@ -68,6 +76,9 @@ func NewItemMapping(itemRuntimeIDData []byte, requiredItemList []byte, itemVersi
|
|||||||
if data.Version != nil {
|
if data.Version != nil {
|
||||||
itemRuntimeIDToVersion[rid] = *data.Version
|
itemRuntimeIDToVersion[rid] = *data.Version
|
||||||
}
|
}
|
||||||
|
if data.Data != nil {
|
||||||
|
itemRuntimeIDToData[rid] = data.Data
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,7 +86,7 @@ func NewItemMapping(itemRuntimeIDData []byte, requiredItemList []byte, itemVersi
|
|||||||
panic("couldn't find air")
|
panic("couldn't find air")
|
||||||
}
|
}
|
||||||
|
|
||||||
return &DefaultItemMapping{itemRuntimeIDsToNames: itemRuntimeIDsToNames, itemNamesToRuntimeIDs: itemNamesToRuntimeIDs, itemRuntimeIDToVersion: itemRuntimeIDToVersion, airRID: *airRID, itemVersion: itemVersion}
|
return &DefaultItemMapping{itemRuntimeIDsToNames: itemRuntimeIDsToNames, itemNamesToRuntimeIDs: itemNamesToRuntimeIDs, itemRuntimeIDToVersion: itemRuntimeIDToVersion, airRID: *airRID, itemVersion: itemVersion, itemRuntimeIDToData: itemRuntimeIDToData}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *DefaultItemMapping) ItemRuntimeIDToName(runtimeID int32) (name string, found bool) {
|
func (m *DefaultItemMapping) ItemRuntimeIDToName(runtimeID int32) (name string, found bool) {
|
||||||
@@ -99,6 +110,13 @@ func (m *DefaultItemMapping) ItemRuntimeIDToVersion(runtimeID int32) (version ui
|
|||||||
return v, ok
|
return v, ok
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *DefaultItemMapping) ItemRuntimeIDToData(runtimeID int32) (data map[string]any, found bool) {
|
||||||
|
defer m.mu.Unlock()
|
||||||
|
m.mu.Lock()
|
||||||
|
d, ok := m.itemRuntimeIDToData[runtimeID]
|
||||||
|
return d, ok
|
||||||
|
}
|
||||||
|
|
||||||
func (m *DefaultItemMapping) RegisterEntry(name string) int32 {
|
func (m *DefaultItemMapping) RegisterEntry(name string) int32 {
|
||||||
defer m.mu.Unlock()
|
defer m.mu.Unlock()
|
||||||
m.mu.Lock()
|
m.mu.Lock()
|
||||||
@@ -111,13 +129,16 @@ func (m *DefaultItemMapping) RegisterEntry(name string) int32 {
|
|||||||
return nextRID
|
return nextRID
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *DefaultItemMapping) RegisterEntryRID(name string, rid int32, version uint8) {
|
func (m *DefaultItemMapping) RegisterEntryRID(name string, rid int32, version uint8, data map[string]any) {
|
||||||
defer m.mu.Unlock()
|
defer m.mu.Unlock()
|
||||||
m.mu.Lock()
|
m.mu.Lock()
|
||||||
if _, ok := m.itemNamesToRuntimeIDs[name]; !ok {
|
if _, ok := m.itemNamesToRuntimeIDs[name]; !ok {
|
||||||
m.itemNamesToRuntimeIDs[name] = rid
|
m.itemNamesToRuntimeIDs[name] = rid
|
||||||
m.itemRuntimeIDsToNames[rid] = name
|
m.itemRuntimeIDsToNames[rid] = name
|
||||||
m.itemRuntimeIDToVersion[rid] = version
|
m.itemRuntimeIDToVersion[rid] = version
|
||||||
|
if data != nil {
|
||||||
|
m.itemRuntimeIDToData[rid] = data
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user