Add support for protocol version 1.21.100 (#12)
This commit is contained in:
33
README.md
33
README.md
@@ -3,22 +3,23 @@
|
|||||||
A gophertunnel protocol interface implementation to support older Minecraft Bedrock versions.
|
A gophertunnel protocol interface implementation to support older Minecraft Bedrock versions.
|
||||||
|
|
||||||
## Supported Versions
|
## Supported Versions
|
||||||
| Protocol ID | Version | Support |
|
| Protocol ID | Version | Support |
|
||||||
|-------------|---------|---------|
|
|-------------|----------|---------|
|
||||||
| 819 | 1.21.93 | ✅ |
|
| 827 | 1.21.100 | ✅ |
|
||||||
| 818 | 1.21.90 | ✅ |
|
| 819 | 1.21.93 | ✅ |
|
||||||
| 800 | 1.21.80 | ✅ |
|
| 818 | 1.21.90 | ✅ |
|
||||||
| 786 | 1.21.70 | ✅ |
|
| 800 | 1.21.80 | ✅ |
|
||||||
| 776 | 1.21.60 | ✅ |
|
| 786 | 1.21.70 | ✅ |
|
||||||
| 766 | 1.21.50 | ✅ |
|
| 776 | 1.21.60 | ✅ |
|
||||||
| 748 | 1.21.40 | ✅ |
|
| 766 | 1.21.50 | ✅ |
|
||||||
| 729 | 1.21.30 | ✅ |
|
| 748 | 1.21.40 | ✅ |
|
||||||
| 712 | 1.21.20 | ✅ |
|
| 729 | 1.21.30 | ✅ |
|
||||||
| 686 | 1.21.2 | ✅ |
|
| 712 | 1.21.20 | ✅ |
|
||||||
| 685 | 1.21.0 | ✅ |
|
| 686 | 1.21.2 | ✅ |
|
||||||
| 671 | 1.20.80 | ✅ |
|
| 685 | 1.21.0 | ✅ |
|
||||||
| 662 | 1.20.70 | ✅ |
|
| 671 | 1.20.80 | ✅ |
|
||||||
| 649 | 1.20.60 | ✅ |
|
| 662 | 1.20.70 | ✅ |
|
||||||
|
| 649 | 1.20.60 | ✅ |
|
||||||
|
|
||||||
<= 1.20.50 is not possible to support due to different compression logic and gophertunnel does not provide a way to
|
<= 1.20.50 is not possible to support due to different compression logic and gophertunnel does not provide a way to
|
||||||
support dynamic compression.
|
support dynamic compression.
|
||||||
|
|||||||
@@ -4,11 +4,12 @@ import (
|
|||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/samber/lo"
|
|
||||||
"github.com/sandertv/gophertunnel/minecraft/nbt"
|
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
"github.com/samber/lo"
|
||||||
|
"github.com/sandertv/gophertunnel/minecraft/nbt"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|||||||
@@ -2,15 +2,16 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
"log"
|
||||||
|
"os"
|
||||||
|
"sync"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/akmalfairuz/legacy-version/legacyver"
|
"github.com/akmalfairuz/legacy-version/legacyver"
|
||||||
"github.com/pelletier/go-toml"
|
"github.com/pelletier/go-toml"
|
||||||
"github.com/sandertv/gophertunnel/minecraft"
|
"github.com/sandertv/gophertunnel/minecraft"
|
||||||
"github.com/sandertv/gophertunnel/minecraft/auth"
|
"github.com/sandertv/gophertunnel/minecraft/auth"
|
||||||
"golang.org/x/oauth2"
|
"golang.org/x/oauth2"
|
||||||
"log"
|
|
||||||
"os"
|
|
||||||
"sync"
|
|
||||||
"time"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// The following program implements a proxy that forwards players from one local address to a remote address.
|
// The following program implements a proxy that forwards players from one local address to a remote address.
|
||||||
|
|||||||
16
go.mod
16
go.mod
@@ -5,16 +5,16 @@ go 1.24
|
|||||||
toolchain go1.24.0
|
toolchain go1.24.0
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/df-mc/dragonfly v0.10.3
|
github.com/df-mc/dragonfly v0.10.5
|
||||||
github.com/df-mc/worldupgrader v1.0.19
|
github.com/df-mc/worldupgrader v1.0.19
|
||||||
github.com/go-gl/mathgl v1.2.0
|
github.com/go-gl/mathgl v1.2.0
|
||||||
github.com/google/uuid v1.6.0
|
github.com/google/uuid v1.6.0
|
||||||
github.com/pelletier/go-toml v1.9.5
|
github.com/pelletier/go-toml v1.9.5
|
||||||
github.com/rogpeppe/go-internal v1.14.1
|
github.com/rogpeppe/go-internal v1.14.1
|
||||||
github.com/samber/lo v1.49.1
|
github.com/samber/lo v1.49.1
|
||||||
github.com/sandertv/gophertunnel v1.47.4
|
github.com/sandertv/gophertunnel v1.49.0
|
||||||
github.com/segmentio/fasthash v1.0.3
|
github.com/segmentio/fasthash v1.0.3
|
||||||
golang.org/x/exp v0.0.0-20250305212735-054e65f0b394
|
golang.org/x/exp v0.0.0-20250718183923-645b1fa84792
|
||||||
golang.org/x/image v0.25.0
|
golang.org/x/image v0.25.0
|
||||||
golang.org/x/oauth2 v0.30.0
|
golang.org/x/oauth2 v0.30.0
|
||||||
)
|
)
|
||||||
@@ -22,13 +22,13 @@ require (
|
|||||||
require (
|
require (
|
||||||
github.com/brentp/intintmap v0.0.0-20190211203843-30dc0ade9af9 // indirect
|
github.com/brentp/intintmap v0.0.0-20190211203843-30dc0ade9af9 // 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/v4 v4.1.0 // indirect
|
github.com/go-jose/go-jose/v4 v4.1.2 // indirect
|
||||||
github.com/golang/snappy v1.0.0 // indirect
|
github.com/golang/snappy v1.0.0 // indirect
|
||||||
github.com/klauspost/compress v1.18.0 // 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.3-0.20250305181847-6af3e95113d6 // indirect
|
github.com/sandertv/go-raknet v1.14.3-0.20250305181847-6af3e95113d6 // indirect
|
||||||
golang.org/x/crypto v0.39.0 // indirect
|
golang.org/x/crypto v0.41.0 // indirect
|
||||||
golang.org/x/mod v0.25.0 // indirect
|
golang.org/x/mod v0.26.0 // indirect
|
||||||
golang.org/x/net v0.41.0 // indirect
|
golang.org/x/net v0.43.0 // indirect
|
||||||
golang.org/x/text v0.26.0 // indirect
|
golang.org/x/text v0.28.0 // indirect
|
||||||
)
|
)
|
||||||
|
|||||||
30
go.sum
30
go.sum
@@ -1,11 +1,19 @@
|
|||||||
github.com/brentp/intintmap v0.0.0-20190211203843-30dc0ade9af9 h1:/G0ghZwrhou0Wq21qc1vXXMm/t/aKWkALWwITptKbE0=
|
github.com/brentp/intintmap v0.0.0-20190211203843-30dc0ade9af9 h1:/G0ghZwrhou0Wq21qc1vXXMm/t/aKWkALWwITptKbE0=
|
||||||
github.com/brentp/intintmap v0.0.0-20190211203843-30dc0ade9af9/go.mod h1:TOk10ahXejq9wkEaym3KPRNeuR/h5Jx+s8QRWIa2oTM=
|
github.com/brentp/intintmap v0.0.0-20190211203843-30dc0ade9af9/go.mod h1:TOk10ahXejq9wkEaym3KPRNeuR/h5Jx+s8QRWIa2oTM=
|
||||||
|
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
|
||||||
|
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||||
|
github.com/cooldogedev/gophertunnel v0.0.0-20250805131657-cc74f1797ff7 h1:IvKtI+ka2fAVh+QFEuLjLTQPyYARaem3q9pr+Y7wJCI=
|
||||||
|
github.com/cooldogedev/gophertunnel v0.0.0-20250805131657-cc74f1797ff7/go.mod h1:lmRarAmn25V/+QeiUbUDXeA26bEaNlX1wGEM/rj39ew=
|
||||||
|
github.com/cooldogedev/gophertunnel v0.0.0-20250806215416-758d5047d822 h1:cW4FrZUxjdJBoSD3Fpw7Z86LQJHtTK7o9lIgGXuaZ3Q=
|
||||||
|
github.com/cooldogedev/gophertunnel v0.0.0-20250806215416-758d5047d822/go.mod h1:lmRarAmn25V/+QeiUbUDXeA26bEaNlX1wGEM/rj39ew=
|
||||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/df-mc/dragonfly v0.9.20-0.20241229163702-cc7e4ee0e3ce h1:mhBn/ezojzACPHeg+Y9NnU2bbYCozx27RgpfWUPw4i0=
|
github.com/df-mc/dragonfly v0.9.20-0.20241229163702-cc7e4ee0e3ce h1:mhBn/ezojzACPHeg+Y9NnU2bbYCozx27RgpfWUPw4i0=
|
||||||
github.com/df-mc/dragonfly v0.9.20-0.20241229163702-cc7e4ee0e3ce/go.mod h1:hH1eU9lmucLNLehzxXzOUOmHJQLz3DLpQMUqIKcz8YI=
|
github.com/df-mc/dragonfly v0.9.20-0.20241229163702-cc7e4ee0e3ce/go.mod h1:hH1eU9lmucLNLehzxXzOUOmHJQLz3DLpQMUqIKcz8YI=
|
||||||
github.com/df-mc/dragonfly v0.10.3 h1:t0mxRvjjgG8uBevqqzejJVL2M6obi6RYePMTPDlXo74=
|
github.com/df-mc/dragonfly v0.10.3 h1:t0mxRvjjgG8uBevqqzejJVL2M6obi6RYePMTPDlXo74=
|
||||||
github.com/df-mc/dragonfly v0.10.3/go.mod h1:pO7nuyRKV50ZVZzB7AhTMU/0p4cvk1/yCu43vFqAzcI=
|
github.com/df-mc/dragonfly v0.10.3/go.mod h1:pO7nuyRKV50ZVZzB7AhTMU/0p4cvk1/yCu43vFqAzcI=
|
||||||
|
github.com/df-mc/dragonfly v0.10.5 h1:vn3Mwh7vWPDtIdss4QEOP8vSZGHRAjyLvrOEM5mEUI0=
|
||||||
|
github.com/df-mc/dragonfly v0.10.5/go.mod h1:/KjoqvIe5+ZxuFUPSRey9UzQS3GkTgAyTH0jTYFMs/g=
|
||||||
github.com/df-mc/goleveldb v1.1.9 h1:ihdosZyy5jkQKrxucTQmN90jq/2lUwQnJZjIYIC/9YU=
|
github.com/df-mc/goleveldb v1.1.9 h1:ihdosZyy5jkQKrxucTQmN90jq/2lUwQnJZjIYIC/9YU=
|
||||||
github.com/df-mc/goleveldb v1.1.9/go.mod h1:+NHCup03Sci5q84APIA21z3iPZCuk6m6ABtg4nANCSk=
|
github.com/df-mc/goleveldb v1.1.9/go.mod h1:+NHCup03Sci5q84APIA21z3iPZCuk6m6ABtg4nANCSk=
|
||||||
github.com/df-mc/worldupgrader v1.0.18 h1:Q34X9ID/hGuDyj9oiq+dpyjOaJdNxhVmVUepf/EPYDA=
|
github.com/df-mc/worldupgrader v1.0.18 h1:Q34X9ID/hGuDyj9oiq+dpyjOaJdNxhVmVUepf/EPYDA=
|
||||||
@@ -19,6 +27,8 @@ github.com/go-jose/go-jose/v4 v4.0.5 h1:M6T8+mKZl/+fNNuFHvGIzDz7BTLQPIounk/b9dw3
|
|||||||
github.com/go-jose/go-jose/v4 v4.0.5/go.mod h1:s3P1lRrkT8igV8D9OjyL4WRyHvjB6a4JSllnOrmmBOA=
|
github.com/go-jose/go-jose/v4 v4.0.5/go.mod h1:s3P1lRrkT8igV8D9OjyL4WRyHvjB6a4JSllnOrmmBOA=
|
||||||
github.com/go-jose/go-jose/v4 v4.1.0 h1:cYSYxd3pw5zd2FSXk2vGdn9igQU2PS8MuxrCOCl0FdY=
|
github.com/go-jose/go-jose/v4 v4.1.0 h1:cYSYxd3pw5zd2FSXk2vGdn9igQU2PS8MuxrCOCl0FdY=
|
||||||
github.com/go-jose/go-jose/v4 v4.1.0/go.mod h1:GG/vqmYm3Von2nYiB2vGTXzdoNKE5tix5tuc6iAd+sw=
|
github.com/go-jose/go-jose/v4 v4.1.0/go.mod h1:GG/vqmYm3Von2nYiB2vGTXzdoNKE5tix5tuc6iAd+sw=
|
||||||
|
github.com/go-jose/go-jose/v4 v4.1.2 h1:TK/7NqRQZfgAh+Td8AlsrvtPoUyiHh0LqVvokh+1vHI=
|
||||||
|
github.com/go-jose/go-jose/v4 v4.1.2/go.mod h1:22cg9HWM1pOlnRiY+9cQYJ9XHmya1bYW8OeDM6Ku6Oo=
|
||||||
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 v1.0.0 h1:Oy607GVXHs7RtbggtPBnr2RmDArIsAefDwvrdWvRhGs=
|
github.com/golang/snappy v1.0.0 h1:Oy607GVXHs7RtbggtPBnr2RmDArIsAefDwvrdWvRhGs=
|
||||||
@@ -62,6 +72,10 @@ github.com/sandertv/gophertunnel v1.47.3 h1:MsHv8QEx17+N/39BnAvHn/KU9zv8Rt9ZHTKa
|
|||||||
github.com/sandertv/gophertunnel v1.47.3/go.mod h1:lvzOdyb2fkoo3uySe++hy4UKq0I649oUFJKkro2ZHpY=
|
github.com/sandertv/gophertunnel v1.47.3/go.mod h1:lvzOdyb2fkoo3uySe++hy4UKq0I649oUFJKkro2ZHpY=
|
||||||
github.com/sandertv/gophertunnel v1.47.4 h1:PmNbEUf9+7Fk8bP2875cvYTt22g0d4eeQhtd1dxjqqA=
|
github.com/sandertv/gophertunnel v1.47.4 h1:PmNbEUf9+7Fk8bP2875cvYTt22g0d4eeQhtd1dxjqqA=
|
||||||
github.com/sandertv/gophertunnel v1.47.4/go.mod h1:lvzOdyb2fkoo3uySe++hy4UKq0I649oUFJKkro2ZHpY=
|
github.com/sandertv/gophertunnel v1.47.4/go.mod h1:lvzOdyb2fkoo3uySe++hy4UKq0I649oUFJKkro2ZHpY=
|
||||||
|
github.com/sandertv/gophertunnel v1.48.1 h1:+DleZznxkYugxEIEFAKN4JDfYSv/zm6//MfYFdIgyq8=
|
||||||
|
github.com/sandertv/gophertunnel v1.48.1/go.mod h1:lmRarAmn25V/+QeiUbUDXeA26bEaNlX1wGEM/rj39ew=
|
||||||
|
github.com/sandertv/gophertunnel v1.49.0 h1:9FIl4GGYMrFTmBPgkOTUskGWRQHIg4NMpY8JdM6SrCg=
|
||||||
|
github.com/sandertv/gophertunnel v1.49.0/go.mod h1:lmRarAmn25V/+QeiUbUDXeA26bEaNlX1wGEM/rj39ew=
|
||||||
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/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
|
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
|
||||||
@@ -72,10 +86,16 @@ golang.org/x/crypto v0.38.0 h1:jt+WWG8IZlBnVbomuhg2Mdq0+BBQaHbtqHEFEigjUV8=
|
|||||||
golang.org/x/crypto v0.38.0/go.mod h1:MvrbAqul58NNYPKnOra203SB9vpuZW0e+RRZV+Ggqjw=
|
golang.org/x/crypto v0.38.0/go.mod h1:MvrbAqul58NNYPKnOra203SB9vpuZW0e+RRZV+Ggqjw=
|
||||||
golang.org/x/crypto v0.39.0 h1:SHs+kF4LP+f+p14esP5jAoDpHU8Gu/v9lFRK6IT5imM=
|
golang.org/x/crypto v0.39.0 h1:SHs+kF4LP+f+p14esP5jAoDpHU8Gu/v9lFRK6IT5imM=
|
||||||
golang.org/x/crypto v0.39.0/go.mod h1:L+Xg3Wf6HoL4Bn4238Z6ft6KfEpN0tJGo53AAPC632U=
|
golang.org/x/crypto v0.39.0/go.mod h1:L+Xg3Wf6HoL4Bn4238Z6ft6KfEpN0tJGo53AAPC632U=
|
||||||
|
golang.org/x/crypto v0.40.0 h1:r4x+VvoG5Fm+eJcxMaY8CQM7Lb0l1lsmjGBQ6s8BfKM=
|
||||||
|
golang.org/x/crypto v0.40.0/go.mod h1:Qr1vMER5WyS2dfPHAlsOj01wgLbsyWtFn/aY+5+ZdxY=
|
||||||
|
golang.org/x/crypto v0.41.0 h1:WKYxWedPGCTVVl5+WHSSrOBT0O8lx32+zxmHxijgXp4=
|
||||||
|
golang.org/x/crypto v0.41.0/go.mod h1:pO5AFd7FA68rFak7rOAGVuygIISepHftHnr8dr6+sUc=
|
||||||
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/exp v0.0.0-20250305212735-054e65f0b394 h1:nDVHiLt8aIbd/VzvPWN6kSOPE7+F/fNFDSXLVYkE/Iw=
|
golang.org/x/exp v0.0.0-20250305212735-054e65f0b394 h1:nDVHiLt8aIbd/VzvPWN6kSOPE7+F/fNFDSXLVYkE/Iw=
|
||||||
golang.org/x/exp v0.0.0-20250305212735-054e65f0b394/go.mod h1:sIifuuw/Yco/y6yb6+bDNfyeQ/MdPUy/hKEMYQV17cM=
|
golang.org/x/exp v0.0.0-20250305212735-054e65f0b394/go.mod h1:sIifuuw/Yco/y6yb6+bDNfyeQ/MdPUy/hKEMYQV17cM=
|
||||||
|
golang.org/x/exp v0.0.0-20250718183923-645b1fa84792 h1:R9PFI6EUdfVKgwKjZef7QIwGcBKu86OEFpJ9nUEP2l4=
|
||||||
|
golang.org/x/exp v0.0.0-20250718183923-645b1fa84792/go.mod h1:A+z0yzpGtvnG90cToK5n2tu8UJVP2XUATh+r+sfOOOc=
|
||||||
golang.org/x/image v0.21.0 h1:c5qV36ajHpdj4Qi0GnE0jUc/yuo33OLFaa0d+crTD5s=
|
golang.org/x/image v0.21.0 h1:c5qV36ajHpdj4Qi0GnE0jUc/yuo33OLFaa0d+crTD5s=
|
||||||
golang.org/x/image v0.21.0/go.mod h1:vUbsLavqK/W303ZroQQVKQ+Af3Yl6Uz1Ppu5J/cLz78=
|
golang.org/x/image v0.21.0/go.mod h1:vUbsLavqK/W303ZroQQVKQ+Af3Yl6Uz1Ppu5J/cLz78=
|
||||||
golang.org/x/image v0.25.0 h1:Y6uW6rH1y5y/LK1J8BPWZtr6yZ7hrsy6hFrXjgsc2fQ=
|
golang.org/x/image v0.25.0 h1:Y6uW6rH1y5y/LK1J8BPWZtr6yZ7hrsy6hFrXjgsc2fQ=
|
||||||
@@ -86,6 +106,8 @@ golang.org/x/mod v0.24.0 h1:ZfthKaKaT4NrhGVZHO1/WDTwGES4De8KtWO0SIbNJMU=
|
|||||||
golang.org/x/mod v0.24.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww=
|
golang.org/x/mod v0.24.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww=
|
||||||
golang.org/x/mod v0.25.0 h1:n7a+ZbQKQA/Ysbyb0/6IbB1H/X41mKgbhfv7AfG/44w=
|
golang.org/x/mod v0.25.0 h1:n7a+ZbQKQA/Ysbyb0/6IbB1H/X41mKgbhfv7AfG/44w=
|
||||||
golang.org/x/mod v0.25.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww=
|
golang.org/x/mod v0.25.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww=
|
||||||
|
golang.org/x/mod v0.26.0 h1:EGMPT//Ezu+ylkCijjPc+f4Aih7sZvaAr+O3EHBxvZg=
|
||||||
|
golang.org/x/mod v0.26.0/go.mod h1:/j6NAhSk8iQ723BGAUyoAcn7SlD7s15Dp9Nd/SfeaFQ=
|
||||||
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
golang.org/x/net v0.38.0 h1:vRMAPTMaeGqVhG5QyLJHqNDwecKTomGeqbnfZyKlBI8=
|
golang.org/x/net v0.38.0 h1:vRMAPTMaeGqVhG5QyLJHqNDwecKTomGeqbnfZyKlBI8=
|
||||||
golang.org/x/net v0.38.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8=
|
golang.org/x/net v0.38.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8=
|
||||||
@@ -93,6 +115,10 @@ golang.org/x/net v0.40.0 h1:79Xs7wF06Gbdcg4kdCCIQArK11Z1hr5POQ6+fIYHNuY=
|
|||||||
golang.org/x/net v0.40.0/go.mod h1:y0hY0exeL2Pku80/zKK7tpntoX23cqL3Oa6njdgRtds=
|
golang.org/x/net v0.40.0/go.mod h1:y0hY0exeL2Pku80/zKK7tpntoX23cqL3Oa6njdgRtds=
|
||||||
golang.org/x/net v0.41.0 h1:vBTly1HeNPEn3wtREYfy4GZ/NECgw2Cnl+nK6Nz3uvw=
|
golang.org/x/net v0.41.0 h1:vBTly1HeNPEn3wtREYfy4GZ/NECgw2Cnl+nK6Nz3uvw=
|
||||||
golang.org/x/net v0.41.0/go.mod h1:B/K4NNqkfmg07DQYrbwvSluqCJOOXwUjeb/5lOisjbA=
|
golang.org/x/net v0.41.0/go.mod h1:B/K4NNqkfmg07DQYrbwvSluqCJOOXwUjeb/5lOisjbA=
|
||||||
|
golang.org/x/net v0.42.0 h1:jzkYrhi3YQWD6MLBJcsklgQsoAcw89EcZbJw8Z614hs=
|
||||||
|
golang.org/x/net v0.42.0/go.mod h1:FF1RA5d3u7nAYA4z2TkclSCKh68eSXtiFwcWQpPXdt8=
|
||||||
|
golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE=
|
||||||
|
golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg=
|
||||||
golang.org/x/oauth2 v0.28.0 h1:CrgCKl8PPAVtLnU3c+EDw6x11699EWlsDeWNWKdIOkc=
|
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/oauth2 v0.28.0/go.mod h1:onh5ek6nERTohokkhCD/y2cV4Do3fxFHFuAejCkRWT8=
|
||||||
golang.org/x/oauth2 v0.30.0 h1:dnDm7JmhM45NNpd8FDDeLhK6FwqbOf4MLCM9zb1BOHI=
|
golang.org/x/oauth2 v0.30.0 h1:dnDm7JmhM45NNpd8FDDeLhK6FwqbOf4MLCM9zb1BOHI=
|
||||||
@@ -109,6 +135,10 @@ golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4=
|
|||||||
golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA=
|
golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA=
|
||||||
golang.org/x/text v0.26.0 h1:P42AVeLghgTYr4+xUnTRKDMqpar+PtX7KWuNQL21L8M=
|
golang.org/x/text v0.26.0 h1:P42AVeLghgTYr4+xUnTRKDMqpar+PtX7KWuNQL21L8M=
|
||||||
golang.org/x/text v0.26.0/go.mod h1:QK15LZJUUQVJxhz7wXgxSy/CJaTFjd0G+YLonydOVQA=
|
golang.org/x/text v0.26.0/go.mod h1:QK15LZJUUQVJxhz7wXgxSy/CJaTFjd0G+YLonydOVQA=
|
||||||
|
golang.org/x/text v0.27.0 h1:4fGWRpyh641NLlecmyl4LOe6yDdfaYNrGb2zdfo4JV4=
|
||||||
|
golang.org/x/text v0.27.0/go.mod h1:1D28KMCvyooCX9hBiosv5Tz/+YLxj0j7XhWjpSUF7CU=
|
||||||
|
golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng=
|
||||||
|
golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4=
|
gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4=
|
||||||
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
|
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
|
||||||
|
|||||||
@@ -2,10 +2,11 @@ package internal
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/df-mc/worldupgrader/blockupgrader"
|
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
|
"github.com/df-mc/worldupgrader/blockupgrader"
|
||||||
)
|
)
|
||||||
|
|
||||||
// StateHash is a struct that may be used as a map key for block states. It contains the name of the block state
|
// StateHash is a struct that may be used as a map key for block states. It contains the name of the block state
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
package chunk
|
package chunk
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/df-mc/dragonfly/server/block/cube"
|
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
|
"github.com/df-mc/dragonfly/server/block/cube"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Chunk is a segment in the world with a size of 16x16x256 blocks. A chunk contains multiple sub chunks
|
// Chunk is a segment in the world with a size of 16x16x256 blocks. A chunk contains multiple sub chunks
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package chunk
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/df-mc/dragonfly/server/block/cube"
|
"github.com/df-mc/dragonfly/server/block/cube"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,8 +2,9 @@ package chunk
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"github.com/df-mc/dragonfly/server/block/cube"
|
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
|
"github.com/df-mc/dragonfly/server/block/cube"
|
||||||
)
|
)
|
||||||
|
|
||||||
// pool is used to pool byte buffers used for encoding chunks.
|
// pool is used to pool byte buffers used for encoding chunks.
|
||||||
|
|||||||
@@ -4,9 +4,10 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/akmalfairuz/legacy-version/mapping"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/akmalfairuz/legacy-version/mapping"
|
||||||
|
|
||||||
"github.com/df-mc/dragonfly/server/block/cube"
|
"github.com/df-mc/dragonfly/server/block/cube"
|
||||||
"github.com/df-mc/worldupgrader/blockupgrader"
|
"github.com/df-mc/worldupgrader/blockupgrader"
|
||||||
"github.com/sandertv/gophertunnel/minecraft/nbt"
|
"github.com/sandertv/gophertunnel/minecraft/nbt"
|
||||||
|
|||||||
@@ -4,12 +4,13 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"embed"
|
"embed"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"github.com/df-mc/worldupgrader/blockupgrader"
|
|
||||||
"github.com/sandertv/gophertunnel/minecraft/nbt"
|
|
||||||
"github.com/sandertv/gophertunnel/minecraft/protocol"
|
|
||||||
"regexp"
|
"regexp"
|
||||||
"sort"
|
"sort"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
|
"github.com/df-mc/worldupgrader/blockupgrader"
|
||||||
|
"github.com/sandertv/gophertunnel/minecraft/nbt"
|
||||||
|
"github.com/sandertv/gophertunnel/minecraft/protocol"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|||||||
13
internal/pool.go
Normal file
13
internal/pool.go
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
package internal
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"sync"
|
||||||
|
)
|
||||||
|
|
||||||
|
// BufferPool is a sync.Pool for buffers used to write compressed data to.
|
||||||
|
var BufferPool = sync.Pool{
|
||||||
|
New: func() any {
|
||||||
|
return bytes.NewBuffer(make([]byte, 0, 256))
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -8,6 +8,7 @@ import (
|
|||||||
// must be set to true if you're using Dragonfly.
|
// must be set to true if you're using Dragonfly.
|
||||||
func All(dragonflyMapping bool) []minecraft.Protocol {
|
func All(dragonflyMapping bool) []minecraft.Protocol {
|
||||||
return []minecraft.Protocol{
|
return []minecraft.Protocol{
|
||||||
|
New819(dragonflyMapping),
|
||||||
New818(dragonflyMapping),
|
New818(dragonflyMapping),
|
||||||
New800(dragonflyMapping),
|
New800(dragonflyMapping),
|
||||||
New786(dragonflyMapping),
|
New786(dragonflyMapping),
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ package legacyver
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
_ "embed"
|
_ "embed"
|
||||||
|
|
||||||
|
"github.com/akmalfairuz/legacy-version/internal"
|
||||||
"github.com/akmalfairuz/legacy-version/internal/chunk"
|
"github.com/akmalfairuz/legacy-version/internal/chunk"
|
||||||
"github.com/akmalfairuz/legacy-version/mapping"
|
"github.com/akmalfairuz/legacy-version/mapping"
|
||||||
"github.com/df-mc/dragonfly/server/block/cube"
|
"github.com/df-mc/dragonfly/server/block/cube"
|
||||||
@@ -43,62 +45,69 @@ func NewBlockTranslator(mapping mapping.Block, latestMapping mapping.Block, pse
|
|||||||
return &DefaultBlockTranslator{mapping: mapping, latest: latestMapping, pse: pse, pe: pe, oldFormat: oldFormat}
|
return &DefaultBlockTranslator{mapping: mapping, latest: latestMapping, pse: pse, pe: pe, oldFormat: oldFormat}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (t *DefaultBlockTranslator) downgradeLevelChunkPacket(pk *packet.LevelChunk) error {
|
||||||
|
count := int(pk.SubChunkCount)
|
||||||
|
if count == protocol.SubChunkRequestModeLimitless || count == protocol.SubChunkRequestModeLimited {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
buf := bytes.NewBuffer(pk.RawPayload)
|
||||||
|
writeBuf := internal.BufferPool.Get().(*bytes.Buffer)
|
||||||
|
defer func() {
|
||||||
|
writeBuf.Reset()
|
||||||
|
internal.BufferPool.Put(writeBuf)
|
||||||
|
}()
|
||||||
|
if !pk.CacheEnabled {
|
||||||
|
c, err := chunk.NetworkDecode(t.latest.Air(), buf, count, false, world.Overworld.Range(), LatestNetworkPersistentEncoding, LatestBlockPaletteEncoding)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
c = t.DowngradeChunk(c)
|
||||||
|
|
||||||
|
payload, err := chunk.NetworkEncode(t.mapping.Air(), c, t.oldFormat, t.pe)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
writeBuf.Write(payload)
|
||||||
|
pk.SubChunkCount = uint32(len(c.Sub()))
|
||||||
|
}
|
||||||
|
safeBytes := buf.Bytes()
|
||||||
|
|
||||||
|
countBorder, err := buf.ReadByte()
|
||||||
|
if err != nil {
|
||||||
|
pk.RawPayload = append(writeBuf.Bytes(), safeBytes...)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
borderBytes := make([]byte, countBorder)
|
||||||
|
if _, err = buf.Read(borderBytes); err != nil {
|
||||||
|
pk.RawPayload = append(writeBuf.Bytes(), safeBytes...)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
writeBuf.WriteByte(countBorder)
|
||||||
|
writeBuf.Write(borderBytes)
|
||||||
|
|
||||||
|
enc := nbt.NewEncoderWithEncoding(writeBuf, nbt.NetworkLittleEndian)
|
||||||
|
dec := nbt.NewDecoderWithEncoding(buf, nbt.NetworkLittleEndian)
|
||||||
|
for {
|
||||||
|
var decNbt map[string]any
|
||||||
|
if err = dec.Decode(&decNbt); err != nil {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
t.mapping.DowngradeBlockActorData(decNbt)
|
||||||
|
|
||||||
|
if err = enc.Encode(decNbt); err != nil {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pk.RawPayload = append(writeBuf.Bytes(), buf.Bytes()...)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func (t *DefaultBlockTranslator) DowngradeBlockPackets(pks []packet.Packet, conn *minecraft.Conn) (result []packet.Packet) {
|
func (t *DefaultBlockTranslator) DowngradeBlockPackets(pks []packet.Packet, conn *minecraft.Conn) (result []packet.Packet) {
|
||||||
for _, pk := range pks {
|
for _, pk := range pks {
|
||||||
switch pk := pk.(type) {
|
switch pk := pk.(type) {
|
||||||
case *packet.LevelChunk:
|
case *packet.LevelChunk:
|
||||||
count := int(pk.SubChunkCount)
|
_ = t.downgradeLevelChunkPacket(pk)
|
||||||
if count == protocol.SubChunkRequestModeLimitless || count == protocol.SubChunkRequestModeLimited {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
buf := bytes.NewBuffer(pk.RawPayload)
|
|
||||||
writeBuf := bytes.NewBuffer(nil)
|
|
||||||
if !pk.CacheEnabled {
|
|
||||||
c, err := chunk.NetworkDecode(t.latest.Air(), buf, count, false, world.Overworld.Range(), LatestNetworkPersistentEncoding, LatestBlockPaletteEncoding)
|
|
||||||
if err != nil {
|
|
||||||
//fmt.Println(err)
|
|
||||||
break
|
|
||||||
}
|
|
||||||
c = t.DowngradeChunk(c)
|
|
||||||
|
|
||||||
payload, err := chunk.NetworkEncode(t.mapping.Air(), c, t.oldFormat, t.pe)
|
|
||||||
if err != nil {
|
|
||||||
//fmt.Println(err)
|
|
||||||
break
|
|
||||||
}
|
|
||||||
writeBuf.Write(payload)
|
|
||||||
pk.SubChunkCount = uint32(len(c.Sub()))
|
|
||||||
}
|
|
||||||
safeBytes := buf.Bytes()
|
|
||||||
|
|
||||||
countBorder, err := buf.ReadByte()
|
|
||||||
if err != nil {
|
|
||||||
pk.RawPayload = append(writeBuf.Bytes(), safeBytes...)
|
|
||||||
break
|
|
||||||
}
|
|
||||||
borderBytes := make([]byte, countBorder)
|
|
||||||
if _, err = buf.Read(borderBytes); err != nil {
|
|
||||||
pk.RawPayload = append(writeBuf.Bytes(), safeBytes...)
|
|
||||||
break
|
|
||||||
}
|
|
||||||
writeBuf.WriteByte(countBorder)
|
|
||||||
writeBuf.Write(borderBytes)
|
|
||||||
|
|
||||||
enc := nbt.NewEncoderWithEncoding(writeBuf, nbt.NetworkLittleEndian)
|
|
||||||
dec := nbt.NewDecoderWithEncoding(buf, nbt.NetworkLittleEndian)
|
|
||||||
for {
|
|
||||||
var decNbt map[string]any
|
|
||||||
if err = dec.Decode(&decNbt); err != nil {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
t.mapping.DowngradeBlockActorData(decNbt)
|
|
||||||
|
|
||||||
if err = enc.Encode(decNbt); err != nil {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pk.RawPayload = append(writeBuf.Bytes(), buf.Bytes()...)
|
|
||||||
case *packet.SubChunk:
|
case *packet.SubChunk:
|
||||||
r := world.Overworld.Range()
|
r := world.Overworld.Range()
|
||||||
if t.oldFormat {
|
if t.oldFormat {
|
||||||
@@ -247,11 +256,11 @@ func (t *DefaultBlockTranslator) DowngradeBlockRuntimeID(input uint32) uint32 {
|
|||||||
}
|
}
|
||||||
state, ok := t.latest.RuntimeIDToState(input)
|
state, ok := t.latest.RuntimeIDToState(input)
|
||||||
if !ok {
|
if !ok {
|
||||||
return t.mapping.Air()
|
return t.mapping.InfoUpdate()
|
||||||
}
|
}
|
||||||
runtimeID, ok := t.mapping.StateToRuntimeID(state)
|
runtimeID, ok := t.mapping.StateToRuntimeID(state)
|
||||||
if !ok {
|
if !ok {
|
||||||
return t.mapping.Air()
|
return t.mapping.InfoUpdate()
|
||||||
}
|
}
|
||||||
return runtimeID
|
return runtimeID
|
||||||
}
|
}
|
||||||
@@ -315,11 +324,11 @@ func (t *DefaultBlockTranslator) UpgradeBlockRuntimeID(input uint32) uint32 {
|
|||||||
}
|
}
|
||||||
state, ok := t.mapping.RuntimeIDToState(input)
|
state, ok := t.mapping.RuntimeIDToState(input)
|
||||||
if !ok {
|
if !ok {
|
||||||
return t.latest.Air()
|
return t.latest.InfoUpdate()
|
||||||
}
|
}
|
||||||
runtimeID, ok := t.latest.StateToRuntimeID(state)
|
runtimeID, ok := t.latest.StateToRuntimeID(state)
|
||||||
if !ok {
|
if !ok {
|
||||||
return t.latest.Air()
|
return t.latest.InfoUpdate()
|
||||||
}
|
}
|
||||||
return runtimeID
|
return runtimeID
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
legacyver/data/block_states_827.nbt
Normal file
BIN
legacyver/data/block_states_827.nbt
Normal file
Binary file not shown.
9256
legacyver/data/required_item_list_827.json
Normal file
9256
legacyver/data/required_item_list_827.json
Normal file
File diff suppressed because it is too large
Load Diff
@@ -2,6 +2,7 @@ package legacyver
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/akmalfairuz/legacy-version/internal/item"
|
"github.com/akmalfairuz/legacy-version/internal/item"
|
||||||
"github.com/akmalfairuz/legacy-version/legacyver/proto"
|
"github.com/akmalfairuz/legacy-version/legacyver/proto"
|
||||||
"github.com/akmalfairuz/legacy-version/mapping"
|
"github.com/akmalfairuz/legacy-version/mapping"
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package legacypacket
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
|
|
||||||
"github.com/akmalfairuz/legacy-version/legacyver/proto"
|
"github.com/akmalfairuz/legacy-version/legacyver/proto"
|
||||||
"github.com/samber/lo"
|
"github.com/samber/lo"
|
||||||
"github.com/sandertv/gophertunnel/minecraft/protocol"
|
"github.com/sandertv/gophertunnel/minecraft/protocol"
|
||||||
@@ -13,7 +14,7 @@ import (
|
|||||||
// accurately recreate the server-side generation in vanilla worlds/servers for increased performance.
|
// accurately recreate the server-side generation in vanilla worlds/servers for increased performance.
|
||||||
type BiomeDefinitionList struct {
|
type BiomeDefinitionList struct {
|
||||||
// BiomeDefinitions is a list of biomes that are available on the server.
|
// BiomeDefinitions is a list of biomes that are available on the server.
|
||||||
BiomeDefinitions []protocol.BiomeDefinition
|
BiomeDefinitions []proto.BiomeDefinition
|
||||||
// StringList is a makeshift dictionary implementation Mojang created to try and reduce the size of the
|
// StringList is a makeshift dictionary implementation Mojang created to try and reduce the size of the
|
||||||
// overall packet. It is a list of common strings that are used in the biome definitions, such as
|
// overall packet. It is a list of common strings that are used in the biome definitions, such as
|
||||||
// biome names, float values or query expressions.
|
// biome names, float values or query expressions.
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ type CameraAimAssist struct {
|
|||||||
TargetMode byte
|
TargetMode byte
|
||||||
// Action is the action that should be performed with the aim assist. This is one of the constants above.
|
// Action is the action that should be performed with the aim assist. This is one of the constants above.
|
||||||
Action byte
|
Action byte
|
||||||
|
// ShowDebugRender specifies if debug render should be shown.
|
||||||
|
ShowDebugRender bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// ID ...
|
// ID ...
|
||||||
@@ -37,4 +39,7 @@ func (pk *CameraAimAssist) Marshal(io protocol.IO) {
|
|||||||
io.Float32(&pk.Distance)
|
io.Float32(&pk.Distance)
|
||||||
io.Uint8(&pk.TargetMode)
|
io.Uint8(&pk.TargetMode)
|
||||||
io.Uint8(&pk.Action)
|
io.Uint8(&pk.Action)
|
||||||
|
if proto.IsProtoGTE(io, proto.ID827) {
|
||||||
|
io.Bool(&pk.ShowDebugRender)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ type CameraInstruction struct {
|
|||||||
Target protocol.Optional[protocol.CameraInstructionTarget]
|
Target protocol.Optional[protocol.CameraInstructionTarget]
|
||||||
// RemoveTarget can be set to true to remove the current aim assist target.
|
// RemoveTarget can be set to true to remove the current aim assist target.
|
||||||
RemoveTarget protocol.Optional[bool]
|
RemoveTarget protocol.Optional[bool]
|
||||||
|
// FieldOfView is a camera instruction that updates the field of view for the camera.
|
||||||
|
FieldOfView protocol.Optional[protocol.CameraInstructionFieldOfView]
|
||||||
}
|
}
|
||||||
|
|
||||||
// ID ...
|
// ID ...
|
||||||
@@ -33,4 +35,7 @@ func (pk *CameraInstruction) Marshal(io protocol.IO) {
|
|||||||
protocol.OptionalMarshaler(io, &pk.Target)
|
protocol.OptionalMarshaler(io, &pk.Target)
|
||||||
protocol.OptionalFunc(io, &pk.RemoveTarget, io.Bool)
|
protocol.OptionalFunc(io, &pk.RemoveTarget, io.Bool)
|
||||||
}
|
}
|
||||||
|
if proto.IsProtoGTE(io, proto.ID827) {
|
||||||
|
protocol.OptionalMarshaler(io, &pk.FieldOfView)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ func (pk *CorrectPlayerMovePrediction) Marshal(io protocol.IO) {
|
|||||||
}
|
}
|
||||||
io.Vec3(&pk.Position)
|
io.Vec3(&pk.Position)
|
||||||
io.Vec3(&pk.Delta)
|
io.Vec3(&pk.Delta)
|
||||||
if proto.IsProtoGTE(io, proto.ID671) {
|
if proto.IsProtoGTE(io, proto.ID671) && proto.IsProtoLT(io, proto.ID827) {
|
||||||
if pk.PredictionType == packet.PredictionTypeVehicle {
|
if pk.PredictionType == packet.PredictionTypeVehicle {
|
||||||
io.Vec2(&pk.Rotation)
|
io.Vec2(&pk.Rotation)
|
||||||
if proto.IsProtoGTE(io, proto.ID712) {
|
if proto.IsProtoGTE(io, proto.ID712) {
|
||||||
@@ -49,6 +49,10 @@ func (pk *CorrectPlayerMovePrediction) Marshal(io protocol.IO) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if proto.IsProtoGTE(io, proto.ID827) {
|
||||||
|
io.Vec2(&pk.Rotation)
|
||||||
|
protocol.OptionalFunc(io, &pk.VehicleAngularVelocity, io.Float32)
|
||||||
|
}
|
||||||
io.Bool(&pk.OnGround)
|
io.Bool(&pk.OnGround)
|
||||||
io.Varuint64(&pk.Tick)
|
io.Varuint64(&pk.Tick)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -238,6 +238,8 @@ type StartGame struct {
|
|||||||
// its index in the expected block palette. This is useful for servers that wish to support multiple protocol versions
|
// its index in the expected block palette. This is useful for servers that wish to support multiple protocol versions
|
||||||
// and custom blocks, but it will result in extra bytes being written for every block in a sub chunk palette.
|
// and custom blocks, but it will result in extra bytes being written for every block in a sub chunk palette.
|
||||||
UseBlockNetworkIDHashes bool
|
UseBlockNetworkIDHashes bool
|
||||||
|
// TickDeathSystemsEnabled specifies if the new tick death systems are enabled.
|
||||||
|
TickDeathSystemsEnabled bool
|
||||||
// ServerAuthoritativeSound is currently unknown as to what it does.
|
// ServerAuthoritativeSound is currently unknown as to what it does.
|
||||||
ServerAuthoritativeSound bool
|
ServerAuthoritativeSound bool
|
||||||
}
|
}
|
||||||
@@ -336,5 +338,8 @@ func (pk *StartGame) Marshal(io protocol.IO) {
|
|||||||
io.UUID(&pk.WorldTemplateID)
|
io.UUID(&pk.WorldTemplateID)
|
||||||
io.Bool(&pk.ClientSideGeneration)
|
io.Bool(&pk.ClientSideGeneration)
|
||||||
io.Bool(&pk.UseBlockNetworkIDHashes)
|
io.Bool(&pk.UseBlockNetworkIDHashes)
|
||||||
|
if proto.IsProtoGTE(io, proto.ID827) {
|
||||||
|
io.Bool(&pk.TickDeathSystemsEnabled)
|
||||||
|
}
|
||||||
io.Bool(&pk.ServerAuthoritativeSound)
|
io.Bool(&pk.ServerAuthoritativeSound)
|
||||||
}
|
}
|
||||||
|
|||||||
104
legacyver/proto/biome.go
Normal file
104
legacyver/proto/biome.go
Normal file
@@ -0,0 +1,104 @@
|
|||||||
|
package proto
|
||||||
|
|
||||||
|
import "github.com/sandertv/gophertunnel/minecraft/protocol"
|
||||||
|
|
||||||
|
// BiomeDefinition represents a biome definition in the game. This can be a vanilla biome or a completely
|
||||||
|
// custom biome.
|
||||||
|
type BiomeDefinition struct {
|
||||||
|
// NameIndex represents the index of the biome name in the string list.
|
||||||
|
NameIndex int16
|
||||||
|
// BiomeID is the biome ID. This is optional and can be empty.
|
||||||
|
BiomeID int16
|
||||||
|
// Temperature is the temperature of the biome, used for weather, biome behaviours and sky colour.
|
||||||
|
Temperature float32
|
||||||
|
// Downfall is the amount that precipitation affects colours and block changes.
|
||||||
|
Downfall float32
|
||||||
|
// RedSporeDensity is the density of red spore precipitation visuals.
|
||||||
|
RedSporeDensity float32
|
||||||
|
// BlueSporeDensity is the density of blue spore precipitation visuals.
|
||||||
|
BlueSporeDensity float32
|
||||||
|
// AshDensity is the density of ash precipitation visuals.
|
||||||
|
AshDensity float32
|
||||||
|
// WhiteAshDensity is the density of white ash precipitation visuals.
|
||||||
|
WhiteAshDensity float32
|
||||||
|
// Depth ...
|
||||||
|
Depth float32
|
||||||
|
// Scale ...
|
||||||
|
Scale float32
|
||||||
|
// MapWaterColour is an ARGB value for the water colour on maps in the biome.
|
||||||
|
MapWaterColour int32
|
||||||
|
// Rain is true if the biome has rain, false if it is a dry biome.
|
||||||
|
Rain bool
|
||||||
|
// Tags are a list of indices of tags in the string list. These are used to group biomes together for
|
||||||
|
// biome generation and other purposes.
|
||||||
|
Tags protocol.Optional[[]uint16]
|
||||||
|
// ChunkGeneration is optional information to assist in client-side chunk generation. Almost all servers
|
||||||
|
// can and should leave this empty to greatly reduce the size of this packet. Only BDS and servers which
|
||||||
|
// *exactly* match the vanilla chunk generation can benefit from this.
|
||||||
|
ChunkGeneration protocol.Optional[protocol.BiomeChunkGeneration]
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *BiomeDefinition) Marshal(r protocol.IO) {
|
||||||
|
r.Int16(&x.NameIndex)
|
||||||
|
if IsProtoLT(r, ID827) {
|
||||||
|
var opt protocol.Optional[int16]
|
||||||
|
if x.BiomeID != -1 {
|
||||||
|
opt = protocol.Option(x.BiomeID)
|
||||||
|
}
|
||||||
|
protocol.OptionalFunc(r, &opt, r.Int16)
|
||||||
|
x.BiomeID, _ = opt.Value()
|
||||||
|
} else {
|
||||||
|
r.Int16(&x.BiomeID)
|
||||||
|
}
|
||||||
|
r.Float32(&x.Temperature)
|
||||||
|
r.Float32(&x.Downfall)
|
||||||
|
r.Float32(&x.RedSporeDensity)
|
||||||
|
r.Float32(&x.BlueSporeDensity)
|
||||||
|
r.Float32(&x.AshDensity)
|
||||||
|
r.Float32(&x.WhiteAshDensity)
|
||||||
|
r.Float32(&x.Depth)
|
||||||
|
r.Float32(&x.Scale)
|
||||||
|
r.Int32(&x.MapWaterColour)
|
||||||
|
r.Bool(&x.Rain)
|
||||||
|
protocol.OptionalFunc(r, &x.Tags, func(s *[]uint16) {
|
||||||
|
protocol.FuncSlice(r, s, r.Uint16)
|
||||||
|
})
|
||||||
|
protocol.OptionalMarshaler(r, &x.ChunkGeneration)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *BiomeDefinition) FromLatest(bd protocol.BiomeDefinition) BiomeDefinition {
|
||||||
|
x.NameIndex = bd.NameIndex
|
||||||
|
x.BiomeID = bd.BiomeID
|
||||||
|
x.Temperature = bd.Temperature
|
||||||
|
x.Downfall = bd.Downfall
|
||||||
|
x.RedSporeDensity = bd.RedSporeDensity
|
||||||
|
x.BlueSporeDensity = bd.BlueSporeDensity
|
||||||
|
x.AshDensity = bd.AshDensity
|
||||||
|
x.WhiteAshDensity = bd.WhiteAshDensity
|
||||||
|
x.Depth = bd.Depth
|
||||||
|
x.Scale = bd.Scale
|
||||||
|
x.MapWaterColour = bd.MapWaterColour
|
||||||
|
x.Rain = bd.Rain
|
||||||
|
x.Tags = bd.Tags
|
||||||
|
x.ChunkGeneration = bd.ChunkGeneration
|
||||||
|
return *x
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *BiomeDefinition) ToLatest() protocol.BiomeDefinition {
|
||||||
|
return protocol.BiomeDefinition{
|
||||||
|
NameIndex: x.NameIndex,
|
||||||
|
BiomeID: x.BiomeID,
|
||||||
|
Temperature: x.Temperature,
|
||||||
|
Downfall: x.Downfall,
|
||||||
|
RedSporeDensity: x.RedSporeDensity,
|
||||||
|
BlueSporeDensity: x.BlueSporeDensity,
|
||||||
|
AshDensity: x.AshDensity,
|
||||||
|
WhiteAshDensity: x.WhiteAshDensity,
|
||||||
|
Depth: x.Depth,
|
||||||
|
Scale: x.Scale,
|
||||||
|
MapWaterColour: x.MapWaterColour,
|
||||||
|
Rain: x.Rain,
|
||||||
|
Tags: x.Tags,
|
||||||
|
ChunkGeneration: x.ChunkGeneration,
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,6 +3,7 @@ package proto
|
|||||||
import "github.com/sandertv/gophertunnel/minecraft/protocol"
|
import "github.com/sandertv/gophertunnel/minecraft/protocol"
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
ID827 = 827 // v1.21.100
|
||||||
ID819 = 819 // v1.21.93
|
ID819 = 819 // v1.21.93
|
||||||
ID818 = 818 // v1.21.90
|
ID818 = 818 // v1.21.90
|
||||||
ID800 = 800 // v1.21.80
|
ID800 = 800 // v1.21.80
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package proto
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/sandertv/gophertunnel/minecraft/protocol"
|
"github.com/sandertv/gophertunnel/minecraft/protocol"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
package proto
|
package proto
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"image/color"
|
||||||
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/sandertv/gophertunnel/minecraft/protocol"
|
"github.com/sandertv/gophertunnel/minecraft/protocol"
|
||||||
"image/color"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// PlayerListEntry is an entry found in the PlayerList packet. It represents a single player using the UUID
|
// PlayerListEntry is an entry found in the PlayerList packet. It represents a single player using the UUID
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
package legacyver
|
package legacyver
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/akmalfairuz/legacy-version/legacyver/legacypacket"
|
"github.com/akmalfairuz/legacy-version/legacyver/legacypacket"
|
||||||
"github.com/akmalfairuz/legacy-version/legacyver/proto"
|
"github.com/akmalfairuz/legacy-version/legacyver/proto"
|
||||||
"github.com/samber/lo"
|
"github.com/samber/lo"
|
||||||
"github.com/sandertv/gophertunnel/minecraft"
|
"github.com/sandertv/gophertunnel/minecraft"
|
||||||
"github.com/sandertv/gophertunnel/minecraft/protocol"
|
"github.com/sandertv/gophertunnel/minecraft/protocol"
|
||||||
"github.com/sandertv/gophertunnel/minecraft/protocol/packet"
|
"github.com/sandertv/gophertunnel/minecraft/protocol/packet"
|
||||||
"strings"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -294,11 +295,12 @@ func (p *Protocol) downgradePackets(pks []packet.Packet, conn *minecraft.Conn) [
|
|||||||
}
|
}
|
||||||
case *packet.CameraAimAssist:
|
case *packet.CameraAimAssist:
|
||||||
pks[pkIndex] = &legacypacket.CameraAimAssist{
|
pks[pkIndex] = &legacypacket.CameraAimAssist{
|
||||||
Preset: pk.Preset,
|
Preset: pk.Preset,
|
||||||
Angle: pk.Angle,
|
Angle: pk.Angle,
|
||||||
Distance: pk.Distance,
|
Distance: pk.Distance,
|
||||||
TargetMode: pk.TargetMode,
|
TargetMode: pk.TargetMode,
|
||||||
Action: pk.Action,
|
Action: pk.Action,
|
||||||
|
ShowDebugRender: pk.ShowDebugRender,
|
||||||
}
|
}
|
||||||
case *packet.UpdateAttributes:
|
case *packet.UpdateAttributes:
|
||||||
attributes := make([]proto.Attribute, len(pk.Attributes))
|
attributes := make([]proto.Attribute, len(pk.Attributes))
|
||||||
@@ -392,6 +394,7 @@ func (p *Protocol) downgradePackets(pks []packet.Packet, conn *minecraft.Conn) [
|
|||||||
Fade: pk.Fade,
|
Fade: pk.Fade,
|
||||||
Target: pk.Target,
|
Target: pk.Target,
|
||||||
RemoveTarget: pk.RemoveTarget,
|
RemoveTarget: pk.RemoveTarget,
|
||||||
|
FieldOfView: pk.FieldOfView,
|
||||||
}
|
}
|
||||||
case *packet.ChangeDimension:
|
case *packet.ChangeDimension:
|
||||||
pks[pkIndex] = &legacypacket.ChangeDimension{
|
pks[pkIndex] = &legacypacket.ChangeDimension{
|
||||||
@@ -594,6 +597,7 @@ func (p *Protocol) downgradePackets(pks []packet.Packet, conn *minecraft.Conn) [
|
|||||||
ScenarioID: pk.ScenarioID,
|
ScenarioID: pk.ScenarioID,
|
||||||
OwnerID: pk.OwnerID,
|
OwnerID: pk.OwnerID,
|
||||||
UseBlockNetworkIDHashes: pk.UseBlockNetworkIDHashes,
|
UseBlockNetworkIDHashes: pk.UseBlockNetworkIDHashes,
|
||||||
|
TickDeathSystemsEnabled: pk.TickDeathSystemsEnabled,
|
||||||
ServerAuthoritativeSound: pk.ServerAuthoritativeSound,
|
ServerAuthoritativeSound: pk.ServerAuthoritativeSound,
|
||||||
}
|
}
|
||||||
case *packet.CodeBuilderSource:
|
case *packet.CodeBuilderSource:
|
||||||
@@ -721,8 +725,12 @@ func (p *Protocol) downgradePackets(pks []packet.Packet, conn *minecraft.Conn) [
|
|||||||
Visibility: pk.Visibility,
|
Visibility: pk.Visibility,
|
||||||
}
|
}
|
||||||
case *packet.BiomeDefinitionList:
|
case *packet.BiomeDefinitionList:
|
||||||
|
biomeDefinitions := make([]proto.BiomeDefinition, len(pk.BiomeDefinitions))
|
||||||
|
for i, bd := range pk.BiomeDefinitions {
|
||||||
|
biomeDefinitions[i] = (&proto.BiomeDefinition{}).FromLatest(bd)
|
||||||
|
}
|
||||||
pks[pkIndex] = &legacypacket.BiomeDefinitionList{
|
pks[pkIndex] = &legacypacket.BiomeDefinitionList{
|
||||||
BiomeDefinitions: pk.BiomeDefinitions,
|
BiomeDefinitions: biomeDefinitions,
|
||||||
StringList: pk.StringList,
|
StringList: pk.StringList,
|
||||||
}
|
}
|
||||||
case *packet.PlayerList:
|
case *packet.PlayerList:
|
||||||
@@ -868,11 +876,12 @@ func (p *Protocol) upgradePackets(pks []packet.Packet, conn *minecraft.Conn) []p
|
|||||||
}
|
}
|
||||||
case *legacypacket.CameraAimAssist:
|
case *legacypacket.CameraAimAssist:
|
||||||
pks[pkIndex] = &packet.CameraAimAssist{
|
pks[pkIndex] = &packet.CameraAimAssist{
|
||||||
Preset: pk.Preset,
|
Preset: pk.Preset,
|
||||||
Angle: pk.Angle,
|
Angle: pk.Angle,
|
||||||
Distance: pk.Distance,
|
Distance: pk.Distance,
|
||||||
TargetMode: pk.TargetMode,
|
TargetMode: pk.TargetMode,
|
||||||
Action: pk.Action,
|
Action: pk.Action,
|
||||||
|
ShowDebugRender: pk.ShowDebugRender,
|
||||||
}
|
}
|
||||||
case *legacypacket.UpdateAttributes:
|
case *legacypacket.UpdateAttributes:
|
||||||
attributes := make([]protocol.Attribute, len(pk.Attributes))
|
attributes := make([]protocol.Attribute, len(pk.Attributes))
|
||||||
@@ -966,6 +975,7 @@ func (p *Protocol) upgradePackets(pks []packet.Packet, conn *minecraft.Conn) []p
|
|||||||
Fade: pk.Fade,
|
Fade: pk.Fade,
|
||||||
Target: pk.Target,
|
Target: pk.Target,
|
||||||
RemoveTarget: pk.RemoveTarget,
|
RemoveTarget: pk.RemoveTarget,
|
||||||
|
FieldOfView: pk.FieldOfView,
|
||||||
}
|
}
|
||||||
case *legacypacket.ChangeDimension:
|
case *legacypacket.ChangeDimension:
|
||||||
pks[pkIndex] = &packet.ChangeDimension{
|
pks[pkIndex] = &packet.ChangeDimension{
|
||||||
@@ -1156,6 +1166,7 @@ func (p *Protocol) upgradePackets(pks []packet.Packet, conn *minecraft.Conn) []p
|
|||||||
ScenarioID: pk.ScenarioID,
|
ScenarioID: pk.ScenarioID,
|
||||||
OwnerID: pk.OwnerID,
|
OwnerID: pk.OwnerID,
|
||||||
UseBlockNetworkIDHashes: pk.UseBlockNetworkIDHashes,
|
UseBlockNetworkIDHashes: pk.UseBlockNetworkIDHashes,
|
||||||
|
TickDeathSystemsEnabled: pk.TickDeathSystemsEnabled,
|
||||||
ServerAuthoritativeSound: pk.ServerAuthoritativeSound,
|
ServerAuthoritativeSound: pk.ServerAuthoritativeSound,
|
||||||
}
|
}
|
||||||
case *legacypacket.CodeBuilderSource:
|
case *legacypacket.CodeBuilderSource:
|
||||||
@@ -1257,8 +1268,12 @@ func (p *Protocol) upgradePackets(pks []packet.Packet, conn *minecraft.Conn) []p
|
|||||||
Visibility: pk.Visibility,
|
Visibility: pk.Visibility,
|
||||||
}
|
}
|
||||||
case *legacypacket.BiomeDefinitionList:
|
case *legacypacket.BiomeDefinitionList:
|
||||||
|
biomeDefinitions := make([]protocol.BiomeDefinition, len(pk.BiomeDefinitions))
|
||||||
|
for i, bd := range pk.BiomeDefinitions {
|
||||||
|
biomeDefinitions[i] = bd.ToLatest()
|
||||||
|
}
|
||||||
pks[pkIndex] = &packet.BiomeDefinitionList{
|
pks[pkIndex] = &packet.BiomeDefinitionList{
|
||||||
BiomeDefinitions: pk.BiomeDefinitions,
|
BiomeDefinitions: biomeDefinitions,
|
||||||
StringList: pk.StringList,
|
StringList: pk.StringList,
|
||||||
}
|
}
|
||||||
case *legacypacket.PlayerList:
|
case *legacypacket.PlayerList:
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package legacyver
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
_ "embed"
|
_ "embed"
|
||||||
|
|
||||||
"github.com/akmalfairuz/legacy-version/internal/chunk"
|
"github.com/akmalfairuz/legacy-version/internal/chunk"
|
||||||
"github.com/akmalfairuz/legacy-version/legacyver/proto"
|
"github.com/akmalfairuz/legacy-version/legacyver/proto"
|
||||||
"github.com/akmalfairuz/legacy-version/mapping"
|
"github.com/akmalfairuz/legacy-version/mapping"
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package legacyver
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
_ "embed"
|
_ "embed"
|
||||||
|
|
||||||
"github.com/akmalfairuz/legacy-version/internal/chunk"
|
"github.com/akmalfairuz/legacy-version/internal/chunk"
|
||||||
"github.com/akmalfairuz/legacy-version/legacyver/proto"
|
"github.com/akmalfairuz/legacy-version/legacyver/proto"
|
||||||
"github.com/akmalfairuz/legacy-version/mapping"
|
"github.com/akmalfairuz/legacy-version/mapping"
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package legacyver
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
_ "embed"
|
_ "embed"
|
||||||
|
|
||||||
"github.com/akmalfairuz/legacy-version/internal/chunk"
|
"github.com/akmalfairuz/legacy-version/internal/chunk"
|
||||||
"github.com/akmalfairuz/legacy-version/legacyver/proto"
|
"github.com/akmalfairuz/legacy-version/legacyver/proto"
|
||||||
"github.com/akmalfairuz/legacy-version/mapping"
|
"github.com/akmalfairuz/legacy-version/mapping"
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package legacyver
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
_ "embed"
|
_ "embed"
|
||||||
|
|
||||||
"github.com/akmalfairuz/legacy-version/internal/chunk"
|
"github.com/akmalfairuz/legacy-version/internal/chunk"
|
||||||
"github.com/akmalfairuz/legacy-version/legacyver/proto"
|
"github.com/akmalfairuz/legacy-version/legacyver/proto"
|
||||||
"github.com/akmalfairuz/legacy-version/mapping"
|
"github.com/akmalfairuz/legacy-version/mapping"
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package legacyver
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
_ "embed"
|
_ "embed"
|
||||||
|
|
||||||
"github.com/akmalfairuz/legacy-version/internal/chunk"
|
"github.com/akmalfairuz/legacy-version/internal/chunk"
|
||||||
"github.com/akmalfairuz/legacy-version/legacyver/proto"
|
"github.com/akmalfairuz/legacy-version/legacyver/proto"
|
||||||
"github.com/akmalfairuz/legacy-version/mapping"
|
"github.com/akmalfairuz/legacy-version/mapping"
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package legacyver
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
_ "embed"
|
_ "embed"
|
||||||
|
|
||||||
"github.com/akmalfairuz/legacy-version/internal/chunk"
|
"github.com/akmalfairuz/legacy-version/internal/chunk"
|
||||||
"github.com/akmalfairuz/legacy-version/legacyver/proto"
|
"github.com/akmalfairuz/legacy-version/legacyver/proto"
|
||||||
"github.com/akmalfairuz/legacy-version/mapping"
|
"github.com/akmalfairuz/legacy-version/mapping"
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package legacyver
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
_ "embed"
|
_ "embed"
|
||||||
|
|
||||||
"github.com/akmalfairuz/legacy-version/internal/chunk"
|
"github.com/akmalfairuz/legacy-version/internal/chunk"
|
||||||
"github.com/akmalfairuz/legacy-version/legacyver/proto"
|
"github.com/akmalfairuz/legacy-version/legacyver/proto"
|
||||||
"github.com/akmalfairuz/legacy-version/mapping"
|
"github.com/akmalfairuz/legacy-version/mapping"
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package legacyver
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
_ "embed"
|
_ "embed"
|
||||||
|
|
||||||
"github.com/akmalfairuz/legacy-version/internal/chunk"
|
"github.com/akmalfairuz/legacy-version/internal/chunk"
|
||||||
"github.com/akmalfairuz/legacy-version/legacyver/proto"
|
"github.com/akmalfairuz/legacy-version/legacyver/proto"
|
||||||
"github.com/akmalfairuz/legacy-version/mapping"
|
"github.com/akmalfairuz/legacy-version/mapping"
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package legacyver
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
_ "embed"
|
_ "embed"
|
||||||
|
|
||||||
"github.com/akmalfairuz/legacy-version/internal/chunk"
|
"github.com/akmalfairuz/legacy-version/internal/chunk"
|
||||||
"github.com/akmalfairuz/legacy-version/legacyver/proto"
|
"github.com/akmalfairuz/legacy-version/legacyver/proto"
|
||||||
"github.com/akmalfairuz/legacy-version/mapping"
|
"github.com/akmalfairuz/legacy-version/mapping"
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package legacyver
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
_ "embed"
|
_ "embed"
|
||||||
|
|
||||||
"github.com/akmalfairuz/legacy-version/internal/chunk"
|
"github.com/akmalfairuz/legacy-version/internal/chunk"
|
||||||
"github.com/akmalfairuz/legacy-version/legacyver/proto"
|
"github.com/akmalfairuz/legacy-version/legacyver/proto"
|
||||||
"github.com/akmalfairuz/legacy-version/mapping"
|
"github.com/akmalfairuz/legacy-version/mapping"
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package legacyver
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
_ "embed"
|
_ "embed"
|
||||||
|
|
||||||
"github.com/akmalfairuz/legacy-version/internal/chunk"
|
"github.com/akmalfairuz/legacy-version/internal/chunk"
|
||||||
"github.com/akmalfairuz/legacy-version/legacyver/proto"
|
"github.com/akmalfairuz/legacy-version/legacyver/proto"
|
||||||
"github.com/akmalfairuz/legacy-version/mapping"
|
"github.com/akmalfairuz/legacy-version/mapping"
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package legacyver
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
_ "embed"
|
_ "embed"
|
||||||
|
|
||||||
"github.com/akmalfairuz/legacy-version/internal/chunk"
|
"github.com/akmalfairuz/legacy-version/internal/chunk"
|
||||||
"github.com/akmalfairuz/legacy-version/legacyver/proto"
|
"github.com/akmalfairuz/legacy-version/legacyver/proto"
|
||||||
"github.com/akmalfairuz/legacy-version/mapping"
|
"github.com/akmalfairuz/legacy-version/mapping"
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package legacyver
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
_ "embed"
|
_ "embed"
|
||||||
|
|
||||||
"github.com/akmalfairuz/legacy-version/internal/chunk"
|
"github.com/akmalfairuz/legacy-version/internal/chunk"
|
||||||
"github.com/akmalfairuz/legacy-version/legacyver/proto"
|
"github.com/akmalfairuz/legacy-version/legacyver/proto"
|
||||||
"github.com/akmalfairuz/legacy-version/mapping"
|
"github.com/akmalfairuz/legacy-version/mapping"
|
||||||
|
|||||||
@@ -2,32 +2,33 @@ 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"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// ItemVersion819 ...
|
// ItemVersion819 ...
|
||||||
ItemVersion819 = 271
|
ItemVersion819 = 261
|
||||||
// BlockVersion819 ...
|
// BlockVersion819 ...
|
||||||
BlockVersion819 int32 = (1 << 24) | (21 << 16) | (90 << 8)
|
BlockVersion819 int32 = (1 << 24) | (21 << 16) | (90 << 8)
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
//go:embed data/dragonfly_items.json
|
|
||||||
dragonflyLatestItemList []byte
|
|
||||||
//go:embed data/required_item_list_819.json
|
//go:embed data/required_item_list_819.json
|
||||||
requiredItemList819 []byte
|
requiredItemList819 []byte
|
||||||
//go:embed data/block_states_819.nbt
|
//go:embed data/block_states_819.nbt
|
||||||
blockStateData819 []byte
|
blockStateData819 []byte
|
||||||
|
|
||||||
itemMappingLatestPocketMine = mapping.NewItemMapping(requiredItemList819, ItemVersion819)
|
|
||||||
itemMappingLatestDragonfly = mapping.NewItemMapping(dragonflyLatestItemList, ItemVersion819)
|
|
||||||
blockMappingLatest = mapping.NewBlockMapping(blockStateData819)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func itemMappingLatest(dragonflyMapping bool) mapping.Item {
|
func New819(dragonflyMapping bool) *Protocol {
|
||||||
if dragonflyMapping {
|
itemMapping := mapping.NewItemMapping(requiredItemList819, ItemVersion819)
|
||||||
return itemMappingLatestDragonfly
|
blockMapping := mapping.NewBlockMapping(blockStateData819)
|
||||||
|
return &Protocol{
|
||||||
|
ver: "1.21.90",
|
||||||
|
id: proto.ID819,
|
||||||
|
blockTranslator: NewBlockTranslator(blockMapping, blockMappingLatest, chunk.NewNetworkPersistentEncoding(blockMapping, BlockVersion819), chunk.NewBlockPaletteEncoding(blockMapping, BlockVersion819), false),
|
||||||
|
itemTranslator: NewItemTranslator(itemMapping, itemMappingLatest(dragonflyMapping), blockMapping, blockMappingLatest),
|
||||||
}
|
}
|
||||||
return itemMappingLatestPocketMine
|
|
||||||
}
|
}
|
||||||
|
|||||||
34
legacyver/v827.go
Normal file
34
legacyver/v827.go
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
package legacyver
|
||||||
|
|
||||||
|
import (
|
||||||
|
_ "embed"
|
||||||
|
|
||||||
|
"github.com/akmalfairuz/legacy-version/mapping"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// ItemVersion827 ...
|
||||||
|
ItemVersion827 = 271
|
||||||
|
// BlockVersion827 ...
|
||||||
|
BlockVersion827 int32 = (1 << 24) | (21 << 16) | (100 << 8)
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
//go:embed data/dragonfly_items.json
|
||||||
|
dragonflyLatestItemList []byte
|
||||||
|
//go:embed data/required_item_list_827.json
|
||||||
|
requiredItemList827 []byte
|
||||||
|
//go:embed data/block_states_827.nbt
|
||||||
|
blockStateData827 []byte
|
||||||
|
|
||||||
|
itemMappingLatestPocketMine = mapping.NewItemMapping(requiredItemList827, ItemVersion827)
|
||||||
|
itemMappingLatestDragonfly = mapping.NewItemMapping(dragonflyLatestItemList, ItemVersion827)
|
||||||
|
blockMappingLatest = mapping.NewBlockMapping(blockStateData827)
|
||||||
|
)
|
||||||
|
|
||||||
|
func itemMappingLatest(dragonflyMapping bool) mapping.Item {
|
||||||
|
if dragonflyMapping {
|
||||||
|
return itemMappingLatestDragonfly
|
||||||
|
}
|
||||||
|
return itemMappingLatestPocketMine
|
||||||
|
}
|
||||||
@@ -2,9 +2,10 @@ package mapping
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"github.com/akmalfairuz/legacy-version/internal"
|
|
||||||
"sort"
|
"sort"
|
||||||
|
|
||||||
|
"github.com/akmalfairuz/legacy-version/internal"
|
||||||
|
|
||||||
"github.com/df-mc/worldupgrader/blockupgrader"
|
"github.com/df-mc/worldupgrader/blockupgrader"
|
||||||
"github.com/sandertv/gophertunnel/minecraft/nbt"
|
"github.com/sandertv/gophertunnel/minecraft/nbt"
|
||||||
"github.com/sandertv/gophertunnel/minecraft/protocol"
|
"github.com/sandertv/gophertunnel/minecraft/protocol"
|
||||||
@@ -23,6 +24,7 @@ type Block interface {
|
|||||||
// Adjust adjusts the latest mappings to account for custom states.
|
// Adjust adjusts the latest mappings to account for custom states.
|
||||||
Adjust([]protocol.BlockEntry)
|
Adjust([]protocol.BlockEntry)
|
||||||
Air() uint32
|
Air() uint32
|
||||||
|
InfoUpdate() uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
type DefaultBlockMapping struct {
|
type DefaultBlockMapping struct {
|
||||||
@@ -36,6 +38,9 @@ type DefaultBlockMapping struct {
|
|||||||
|
|
||||||
// airRID is the runtime ID of the air block in the latest version of the game.
|
// airRID is the runtime ID of the air block in the latest version of the game.
|
||||||
airRID uint32
|
airRID uint32
|
||||||
|
|
||||||
|
// infoUpdateRID is the runtime ID of the info_update block in the latest version of the game.
|
||||||
|
infoUpdateBlockRID uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewBlockMapping(raw []byte) *DefaultBlockMapping {
|
func NewBlockMapping(raw []byte) *DefaultBlockMapping {
|
||||||
@@ -45,6 +50,7 @@ func NewBlockMapping(raw []byte) *DefaultBlockMapping {
|
|||||||
stateRuntimeIDs := make(map[internal.StateHash]uint32)
|
stateRuntimeIDs := make(map[internal.StateHash]uint32)
|
||||||
runtimeIDToState := make(map[uint32]blockupgrader.BlockState)
|
runtimeIDToState := make(map[uint32]blockupgrader.BlockState)
|
||||||
var airRID *uint32
|
var airRID *uint32
|
||||||
|
var infoUpdateBlockRID *uint32
|
||||||
|
|
||||||
var s blockupgrader.BlockState
|
var s blockupgrader.BlockState
|
||||||
for {
|
for {
|
||||||
@@ -54,8 +60,11 @@ func NewBlockMapping(raw []byte) *DefaultBlockMapping {
|
|||||||
|
|
||||||
rid := uint32(len(states))
|
rid := uint32(len(states))
|
||||||
states = append(states, s)
|
states = append(states, s)
|
||||||
if s.Name == "minecraft:air" {
|
switch s.Name {
|
||||||
|
case "minecraft:air":
|
||||||
airRID = &rid
|
airRID = &rid
|
||||||
|
case "minecraft:info_update":
|
||||||
|
infoUpdateBlockRID = &rid
|
||||||
}
|
}
|
||||||
|
|
||||||
stateRuntimeIDs[internal.HashState(blockupgrader.Upgrade(s))] = rid
|
stateRuntimeIDs[internal.HashState(blockupgrader.Upgrade(s))] = rid
|
||||||
@@ -64,12 +73,16 @@ func NewBlockMapping(raw []byte) *DefaultBlockMapping {
|
|||||||
if airRID == nil {
|
if airRID == nil {
|
||||||
panic("couldn't find air")
|
panic("couldn't find air")
|
||||||
}
|
}
|
||||||
|
if infoUpdateBlockRID == nil {
|
||||||
|
panic("couldn't find info_update block")
|
||||||
|
}
|
||||||
|
|
||||||
return &DefaultBlockMapping{
|
return &DefaultBlockMapping{
|
||||||
states: states,
|
states: states,
|
||||||
stateRuntimeIDs: stateRuntimeIDs,
|
stateRuntimeIDs: stateRuntimeIDs,
|
||||||
runtimeIDToState: runtimeIDToState,
|
runtimeIDToState: runtimeIDToState,
|
||||||
airRID: *airRID,
|
airRID: *airRID,
|
||||||
|
infoUpdateBlockRID: *infoUpdateBlockRID,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -134,3 +147,7 @@ func (m *DefaultBlockMapping) Adjust(entries []protocol.BlockEntry) {
|
|||||||
func (m *DefaultBlockMapping) Air() uint32 {
|
func (m *DefaultBlockMapping) Air() uint32 {
|
||||||
return m.airRID
|
return m.airRID
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *DefaultBlockMapping) InfoUpdate() uint32 {
|
||||||
|
return m.infoUpdateBlockRID
|
||||||
|
}
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ func generateCombinationsRecursively[K comparable, V any](all map[K][]V, iterato
|
|||||||
|
|
||||||
for _, value := range set {
|
for _, value := range set {
|
||||||
current[key] = value
|
current[key] = value
|
||||||
generateCombinationsRecursively(all, iterator, current, output)
|
generateCombinationsRecursively[K, V](all, iterator, current, output)
|
||||||
delete(current, key)
|
delete(current, key)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,9 @@ package mapping
|
|||||||
import (
|
import (
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"github.com/sandertv/gophertunnel/minecraft/nbt"
|
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
|
"github.com/sandertv/gophertunnel/minecraft/nbt"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Item interface {
|
type Item interface {
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
package packbuilder
|
package packbuilder
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/df-mc/dragonfly/server/item/category"
|
"github.com/df-mc/dragonfly/server/item/category"
|
||||||
"golang.org/x/exp/maps"
|
"golang.org/x/exp/maps"
|
||||||
"strings"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// ComponentBuilder represents a builder that can be used to construct an item components map to be sent to a client.
|
// ComponentBuilder represents a builder that can be used to construct an item components map to be sent to a client.
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
package packbuilder
|
package packbuilder
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/df-mc/dragonfly/server/item"
|
"github.com/df-mc/dragonfly/server/item"
|
||||||
"github.com/df-mc/dragonfly/server/world"
|
"github.com/df-mc/dragonfly/server/world"
|
||||||
"strings"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Components returns all the components of the given custom item. If the item has no components, a nil map and false
|
// Components returns all the components of the given custom item. If the item has no components, a nil map and false
|
||||||
|
|||||||
@@ -3,14 +3,15 @@ package packbuilder
|
|||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/df-mc/dragonfly/server/world"
|
|
||||||
"golang.org/x/image/colornames"
|
|
||||||
"image"
|
"image"
|
||||||
"image/png"
|
"image/png"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
_ "unsafe" // Imported for compiler directives.
|
_ "unsafe" // Imported for compiler directives.
|
||||||
|
|
||||||
|
"github.com/df-mc/dragonfly/server/world"
|
||||||
|
"golang.org/x/image/colornames"
|
||||||
)
|
)
|
||||||
|
|
||||||
// buildItems builds all the item-related files for the resource pack. This includes textures, language
|
// buildItems builds all the item-related files for the resource pack. This includes textures, language
|
||||||
|
|||||||
@@ -2,12 +2,13 @@ package packbuilder
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"github.com/google/uuid"
|
|
||||||
"github.com/sandertv/gophertunnel/minecraft/resource"
|
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/google/uuid"
|
||||||
|
"github.com/sandertv/gophertunnel/minecraft/resource"
|
||||||
)
|
)
|
||||||
|
|
||||||
// buildManifest creates a JSON manifest file for the client to be able to read the resource pack. It creates
|
// buildManifest creates a JSON manifest file for the client to be able to read the resource pack. It creates
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
package packbuilder
|
package packbuilder
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"os"
|
||||||
|
|
||||||
"github.com/df-mc/dragonfly/server/world"
|
"github.com/df-mc/dragonfly/server/world"
|
||||||
"github.com/rogpeppe/go-internal/dirhash"
|
"github.com/rogpeppe/go-internal/dirhash"
|
||||||
"github.com/sandertv/gophertunnel/minecraft/resource"
|
"github.com/sandertv/gophertunnel/minecraft/resource"
|
||||||
"os"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// BuildResourcePack builds a resource pack based on custom features that have been registered to the server.
|
// BuildResourcePack builds a resource pack based on custom features that have been registered to the server.
|
||||||
|
|||||||
Reference in New Issue
Block a user