update 1.21.111

This commit is contained in:
ethaniccc
2025-10-05 16:59:50 -04:00
53 changed files with 19315 additions and 9585 deletions

View File

@@ -3,23 +3,24 @@
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 |
|-------------|---------|---------| |-------------|----------|---------|
| 827 | 1.21.100 | ✅ | | 844 | 1.21.111 | ✅ |
| 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.

View File

@@ -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() {

View File

@@ -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.

33
go.mod
View File

@@ -1,36 +1,39 @@
module github.com/akmalfairuz/legacy-version module github.com/akmalfairuz/legacy-version
go 1.24 go 1.24.0
toolchain go1.24.0
require ( require (
github.com/df-mc/dragonfly v0.10.3 github.com/cespare/xxhash/v2 v2.3.0
github.com/df-mc/worldupgrader v1.0.19 github.com/df-mc/dragonfly v0.10.6-0.20250817203556-60bcf6b7432b
github.com/df-mc/worldupgrader v1.0.20
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.50.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-20250819193227-8b4c13bb791b
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.31.0
) )
require ( require (
github.com/brentp/intintmap v0.0.0-20190211203843-30dc0ade9af9 // indirect github.com/brentp/intintmap v0.0.0-20190211203843-30dc0ade9af9 // 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/v4 v4.1.0 // indirect github.com/df-mc/jsonc v1.0.5 // 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/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/mod v0.25.0 // indirect golang.org/x/crypto v0.42.0 // indirect
golang.org/x/net v0.41.0 // indirect golang.org/x/mod v0.27.0 // indirect
golang.org/x/text v0.26.0 // indirect golang.org/x/net v0.44.0 // indirect
golang.org/x/text v0.29.0 // indirect
) )
replace github.com/sandertv/gophertunnel => github.com/cooldogedev/gophertunnel v0.0.0-20250806215416-758d5047d822 replace github.com/sandertv/gophertunnel => ../gophertunnel
replace github.com/df-mc/dragonfly => ../dragonfly
replace github.com/sandertv/go-raknet => ../go-raknet

46
go.sum
View File

@@ -2,27 +2,23 @@ github.com/brentp/intintmap v0.0.0-20190211203843-30dc0ade9af9 h1:/G0ghZwrhou0Wq
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 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
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.10.3 h1:t0mxRvjjgG8uBevqqzejJVL2M6obi6RYePMTPDlXo74=
github.com/df-mc/dragonfly v0.10.3/go.mod h1:pO7nuyRKV50ZVZzB7AhTMU/0p4cvk1/yCu43vFqAzcI=
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.19 h1:BnwRe/lVv9IhwRWZK5olvTYNTKWh7rhFdqNPDMnoKFM= github.com/df-mc/jsonc v1.0.5 h1:O7oh07kbS5AYY+l2Fji6l4h0iHcdjKbxCtK5VlZlLMU=
github.com/df-mc/worldupgrader v1.0.19/go.mod h1:tsSOLTRm9mpG7VHvYpAjjZrkRHWmSbKZAm9bOLNnlDk= github.com/df-mc/jsonc v1.0.5/go.mod h1:+Q++JuCE9IKiP8v7sWImdf/RjQX0nfXyfX6PdfTTmc4=
github.com/df-mc/worldupgrader v1.0.20 h1:wfJyG3bFeaM/HXy7TCiO4HKVw3Mf3N4gPFmgxMHsKnc=
github.com/df-mc/worldupgrader v1.0.20/go.mod h1:tsSOLTRm9mpG7VHvYpAjjZrkRHWmSbKZAm9bOLNnlDk=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/go-gl/mathgl v1.2.0 h1:v2eOj/y1B2afDxF6URV1qCYmo1KW08lAMtTbOn3KXCY= github.com/go-gl/mathgl v1.2.0 h1:v2eOj/y1B2afDxF6URV1qCYmo1KW08lAMtTbOn3KXCY=
github.com/go-gl/mathgl v1.2.0/go.mod h1:pf9+b5J3LFP7iZ4XXaVzZrCle0Q/vNpB/vDe5+3ulRE= github.com/go-gl/mathgl v1.2.0/go.mod h1:pf9+b5J3LFP7iZ4XXaVzZrCle0Q/vNpB/vDe5+3ulRE=
github.com/go-jose/go-jose/v4 v4.1.0 h1:cYSYxd3pw5zd2FSXk2vGdn9igQU2PS8MuxrCOCl0FdY= github.com/go-jose/go-jose/v4 v4.1.2 h1:TK/7NqRQZfgAh+Td8AlsrvtPoUyiHh0LqVvokh+1vHI=
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/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=
github.com/golang/snappy v1.0.0/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v1.0.0/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
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=
github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=
@@ -30,8 +26,6 @@ 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.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo= 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/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/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=
github.com/onsi/ginkgo v1.7.0 h1:WSHQ+IS43OoUrWtD1/bbclrwK8TTH5hzp+umCiuxHgs= github.com/onsi/ginkgo v1.7.0 h1:WSHQ+IS43OoUrWtD1/bbclrwK8TTH5hzp+umCiuxHgs=
github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
@@ -45,30 +39,30 @@ github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0t
github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc=
github.com/samber/lo v1.49.1 h1:4BIFyVfuQSEpluc7Fua+j1NolZHiEHEpaSEKdsH0tew= github.com/samber/lo v1.49.1 h1:4BIFyVfuQSEpluc7Fua+j1NolZHiEHEpaSEKdsH0tew=
github.com/samber/lo v1.49.1/go.mod h1:dO6KHFzUKXgP8LDhU0oI8d2hekjXnGOu0DB8Jecxd6o= github.com/samber/lo v1.49.1/go.mod h1:dO6KHFzUKXgP8LDhU0oI8d2hekjXnGOu0DB8Jecxd6o=
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/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=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
golang.org/x/exp v0.0.0-20250305212735-054e65f0b394 h1:nDVHiLt8aIbd/VzvPWN6kSOPE7+F/fNFDSXLVYkE/Iw= golang.org/x/crypto v0.42.0 h1:chiH31gIWm57EkTXpwnqf8qeuMUi0yekh6mT2AvFlqI=
golang.org/x/exp v0.0.0-20250305212735-054e65f0b394/go.mod h1:sIifuuw/Yco/y6yb6+bDNfyeQ/MdPUy/hKEMYQV17cM= golang.org/x/crypto v0.42.0/go.mod h1:4+rDnOTJhQCx2q7/j6rAN5XDw8kPjeaXEUR2eL94ix8=
golang.org/x/exp v0.0.0-20250819193227-8b4c13bb791b h1:DXr+pvt3nC887026GRP39Ej11UATqWDmWuS99x26cD0=
golang.org/x/exp v0.0.0-20250819193227-8b4c13bb791b/go.mod h1:4QTo5u+SEIbbKW1RacMZq1YEfOBqeXa19JeshGi+zc4=
golang.org/x/image v0.25.0 h1:Y6uW6rH1y5y/LK1J8BPWZtr6yZ7hrsy6hFrXjgsc2fQ= golang.org/x/image v0.25.0 h1:Y6uW6rH1y5y/LK1J8BPWZtr6yZ7hrsy6hFrXjgsc2fQ=
golang.org/x/image v0.25.0/go.mod h1:tCAmOEGthTtkalusGp1g3xa2gke8J6c2N565dTyl9Rs= golang.org/x/image v0.25.0/go.mod h1:tCAmOEGthTtkalusGp1g3xa2gke8J6c2N565dTyl9Rs=
golang.org/x/mod v0.25.0 h1:n7a+ZbQKQA/Ysbyb0/6IbB1H/X41mKgbhfv7AfG/44w= golang.org/x/mod v0.27.0 h1:kb+q2PyFnEADO2IEF935ehFUXlWiNjJWtRNgBLSfbxQ=
golang.org/x/mod v0.25.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww= golang.org/x/mod v0.27.0/go.mod h1:rWI627Fq0DEoudcK+MBkNkCe0EetEaDSwJJkCcjpazc=
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.41.0 h1:vBTly1HeNPEn3wtREYfy4GZ/NECgw2Cnl+nK6Nz3uvw= golang.org/x/net v0.44.0 h1:evd8IRDyfNBMBTTY5XRF1vaZlD+EmWx6x8PkhR04H/I=
golang.org/x/net v0.41.0/go.mod h1:B/K4NNqkfmg07DQYrbwvSluqCJOOXwUjeb/5lOisjbA= golang.org/x/net v0.44.0/go.mod h1:ECOoLqd5U3Lhyeyo/QDCEVQ4sNgYsqvCZ722XogGieY=
golang.org/x/oauth2 v0.30.0 h1:dnDm7JmhM45NNpd8FDDeLhK6FwqbOf4MLCM9zb1BOHI= golang.org/x/oauth2 v0.31.0 h1:8Fq0yVZLh4j4YA47vHKFTa9Ew5XIrCP8LC6UeNZnLxo=
golang.org/x/oauth2 v0.30.0/go.mod h1:B++QgG3ZKulg6sRPGD/mqlHQs5rB3Ml9erfeDY7xKlU= golang.org/x/oauth2 v0.31.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA=
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/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw= golang.org/x/sys v0.36.0 h1:KVRy2GtZBrk1cBYA7MKu5bEZFxQk4NIDV6RLVcC8o0k=
golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= golang.org/x/sys v0.36.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.26.0 h1:P42AVeLghgTYr4+xUnTRKDMqpar+PtX7KWuNQL21L8M= golang.org/x/text v0.29.0 h1:1neNs90w9YzJ9BocxfsQNHKuAT4pkghyXc4nhZ6sJvk=
golang.org/x/text v0.26.0/go.mod h1:QK15LZJUUQVJxhz7wXgxSy/CJaTFjd0G+YLonydOVQA= golang.org/x/text v0.29.0/go.mod h1:7MhJOA9CD2qZyOKYazxdYMF85OwPdEr9jTtBpO7ydH4=
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=

View File

@@ -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

View File

@@ -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

View File

@@ -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"
) )

View File

@@ -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.

View File

@@ -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"

View File

@@ -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 (

View File

@@ -0,0 +1,12 @@
{
"remappedMetas": {
"minecraft:spawn_egg": {
"147": "minecraft:happy_ghast_spawn_egg",
"148": "minecraft:copper_golem_spawn_egg"
}
},
"renamedIds": {
"minecraft:record_lava_chicken": "minecraft:music_disc_lava_chicken",
"minecraft:record_tears": "minecraft:music_disc_tears"
}
}

13
internal/pool.go Normal file
View 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))
},
}

View File

@@ -1,13 +1,27 @@
package legacyver package legacyver
import ( import (
"fmt"
"sync"
"github.com/akmalfairuz/legacy-version/internal/chunk"
"github.com/akmalfairuz/legacy-version/mapping"
"github.com/sandertv/gophertunnel/minecraft" "github.com/sandertv/gophertunnel/minecraft"
"github.com/sandertv/gophertunnel/minecraft/protocol/packet"
)
var (
EnableChunkTranslation = true
blockTranslatorsMu sync.RWMutex
blockTranslators = make(map[int32]BlockTranslator)
) )
// All returns a slice of all legacy protocol versions that are supported. dragonflyMapping // All returns a slice of all legacy protocol versions that are supported. dragonflyMapping
// 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{
New827(dragonflyMapping),
New819(dragonflyMapping), New819(dragonflyMapping),
New818(dragonflyMapping), New818(dragonflyMapping),
New800(dragonflyMapping), New800(dragonflyMapping),
@@ -24,3 +38,37 @@ func All(dragonflyMapping bool) []minecraft.Protocol {
New649(dragonflyMapping), New649(dragonflyMapping),
} }
} }
// lookupOrCreateBlockTranslator looks up a block translator for the given protocol version.
func lookupOrCreateBlockTranslator(protocolVersion, blockVersion int32, blockStateData []byte) BlockTranslator {
blockTranslatorsMu.RLock()
if translator, ok := blockTranslators[protocolVersion]; ok {
blockTranslatorsMu.RUnlock()
return translator
}
blockTranslatorsMu.RUnlock()
blockTranslatorsMu.Lock()
defer blockTranslatorsMu.Unlock()
if translator, ok := blockTranslators[protocolVersion]; ok {
return translator
}
blockMapping := mapping.NewBlockMapping(blockStateData)
ret := NewBlockTranslator(blockMapping, blockMappingLatest, chunk.NewNetworkPersistentEncoding(blockMapping, blockVersion), chunk.NewBlockPaletteEncoding(blockMapping, blockVersion), false)
blockTranslators[protocolVersion] = ret
return ret
}
// DowngradeLevelChunkPacket downgrades the given level chunk packet to the specified protocol version.
func DowngradeLevelChunkPacket(protocolVersion int32, pk *packet.LevelChunk) error {
blockTranslatorsMu.RLock()
translator, ok := blockTranslators[protocolVersion]
blockTranslatorsMu.RUnlock()
if !ok {
return fmt.Errorf("no block translator found for protocol version %d", protocolVersion)
}
return translator.DowngradeLevelChunk(pk)
}

View File

@@ -31,6 +31,10 @@ type BlockTranslator interface {
DowngradeBlockPackets([]packet.Packet, *minecraft.Conn) (result []packet.Packet) DowngradeBlockPackets([]packet.Packet, *minecraft.Conn) (result []packet.Packet)
// UpgradeBlockPackets upgrades the input block packets to the latest block packets. // UpgradeBlockPackets upgrades the input block packets to the latest block packets.
UpgradeBlockPackets([]packet.Packet, *minecraft.Conn) (result []packet.Packet) UpgradeBlockPackets([]packet.Packet, *minecraft.Conn) (result []packet.Packet)
// DowngradeLevelChunk downgrades the given LevelChunk packet to a legacy format.
DowngradeLevelChunk(*packet.LevelChunk) error
// BlockMapping returns the block mapping used by this translator.
BlockMapping() mapping.Block
} }
type DefaultBlockTranslator struct { type DefaultBlockTranslator struct {
@@ -45,63 +49,79 @@ 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) BlockMapping() mapping.Block {
return t.mapping
}
func (t *DefaultBlockTranslator) DowngradeLevelChunk(pk *packet.LevelChunk) error {
count := int(pk.SubChunkCount)
if count == protocol.SubChunkRequestModeLimitless || count == protocol.SubChunkRequestModeLimited {
return nil
}
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 {
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 err
}
borderBytes := make([]byte, countBorder)
if _, err = buf.Read(borderBytes); err != nil {
pk.RawPayload = append(writeBuf.Bytes(), safeBytes...)
return err
}
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) if !EnableChunkTranslation {
if count == protocol.SubChunkRequestModeLimitless || count == protocol.SubChunkRequestModeLimited {
break break
} }
if err := t.DowngradeLevelChunk(pk); err != nil {
buf := bytes.NewBuffer(pk.RawPayload) //fmt.Println(err)
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 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:
if !EnableChunkTranslation {
break
}
r := world.Overworld.Range() r := world.Overworld.Range()
if t.oldFormat { if t.oldFormat {
r = cube.Range{0, 255} r = cube.Range{0, 255}
@@ -251,11 +271,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
} }
@@ -319,11 +339,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
} }

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -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"

View File

@@ -50,6 +50,10 @@ func (pk *CorrectPlayerMovePrediction) Marshal(io protocol.IO) {
protocol.OptionalFunc(io, &pk.VehicleAngularVelocity, io.Float32) protocol.OptionalFunc(io, &pk.VehicleAngularVelocity, io.Float32)
} }
} }
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)
} }

View File

@@ -0,0 +1,31 @@
package legacypacket
import (
"github.com/akmalfairuz/legacy-version/legacyver/proto"
"github.com/sandertv/gophertunnel/minecraft/protocol"
"github.com/sandertv/gophertunnel/minecraft/protocol/packet"
)
// GameRulesChanged is sent by the server to the client to update client-side game rules, such as game rules
// like the 'showCoordinates' game rule.
type GameRulesChanged struct {
// GameRules defines game rules changed with their respective values. The value of these game rules may be
// either 'bool', 'int32' or 'float32'.
// Note that some game rules are server side only, and don't necessarily need to be sent to the client.
// Only changed game rules need to be sent in this packet. Game rules that were not changed do not need to
// be sent if the client is already updated on them.
GameRules []protocol.GameRule
}
// ID ...
func (*GameRulesChanged) ID() uint32 {
return packet.IDGameRulesChanged
}
func (pk *GameRulesChanged) Marshal(io protocol.IO) {
if proto.IsProtoGTE(io, proto.ID844) {
protocol.FuncSlice(io, &pk.GameRules, io.GameRule)
} else {
protocol.FuncSlice(io, &pk.GameRules, io.GameRuleLegacy)
}
}

View File

@@ -1 +0,0 @@
package legacypacket

View File

@@ -9,20 +9,8 @@ import (
// PlayerArmourDamage is sent by the server to damage the armour of a player. It is a very efficient packet, // PlayerArmourDamage is sent by the server to damage the armour of a player. It is a very efficient packet,
// but generally it's much easier to just send a slot update for the damaged armour. // but generally it's much easier to just send a slot update for the damaged armour.
type PlayerArmourDamage struct { type PlayerArmourDamage struct {
// Bitset holds a bitset of 4 bits that indicate which pieces of armour need to have damage dealt to them. // List ...
// The first bit, when toggled, is for a helmet, the second for the chestplate, the third for the leggings List []protocol.PlayerArmourDamageEntry
// and the fourth for boots.
Bitset uint8
// HelmetDamage is the amount of damage that should be dealt to the helmet.
HelmetDamage int32
// ChestplateDamage is the amount of damage that should be dealt to the chestplate.
ChestplateDamage int32
// LeggingsDamage is the amount of damage that should be dealt to the leggings.
LeggingsDamage int32
// BootsDamage is the amount of damage that should be dealt to the boots.
BootsDamage int32
// BodyDamage is the amount of damage that should be dealt to the body.
BodyDamage int32
} }
// ID ... // ID ...
@@ -31,33 +19,49 @@ func (pk *PlayerArmourDamage) ID() uint32 {
} }
func (pk *PlayerArmourDamage) Marshal(io protocol.IO) { func (pk *PlayerArmourDamage) Marshal(io protocol.IO) {
io.Uint8(&pk.Bitset) if proto.IsProtoLT(io, proto.ID844) {
if pk.Bitset&packet.PlayerArmourDamageFlagHelmet != 0 { var bitset uint8
io.Varint32(&pk.HelmetDamage) flags := []uint8{packet.PlayerArmourDamageFlagHelmet, packet.PlayerArmourDamageFlagChestplate, packet.PlayerArmourDamageFlagLeggings, packet.PlayerArmourDamageFlagBoots}
} else { if proto.IsProtoGTE(io, proto.ID712) {
pk.HelmetDamage = 0 flags = append(flags, packet.PlayerArmourDamageFlagBody)
}
if pk.Bitset&packet.PlayerArmourDamageFlagChestplate != 0 {
io.Varint32(&pk.ChestplateDamage)
} else {
pk.ChestplateDamage = 0
}
if pk.Bitset&packet.PlayerArmourDamageFlagLeggings != 0 {
io.Varint32(&pk.LeggingsDamage)
} else {
pk.LeggingsDamage = 0
}
if pk.Bitset&packet.PlayerArmourDamageFlagBoots != 0 {
io.Varint32(&pk.BootsDamage)
} else {
pk.BootsDamage = 0
}
if proto.IsProtoGTE(io, proto.ID712) {
if pk.Bitset&packet.PlayerArmourDamageFlagBody != 0 {
io.Varint32(&pk.BodyDamage)
} else {
pk.BodyDamage = 0
} }
if proto.IsReader(io) {
io.Uint8(&bitset)
pk.List = make([]protocol.PlayerArmourDamageEntry, 0, len(flags))
for _, flag := range flags {
if bitset&flag != 0 {
v := protocol.PlayerArmourDamageEntry{
ArmourSlot: flag,
}
v2 := int32(0)
io.Varint32(&v2)
v.Damage = int16(v2)
pk.List = append(pk.List, v)
}
}
return
}
for _, entry := range pk.List {
if entry.ArmourSlot == packet.PlayerArmourDamageFlagBody && !proto.IsProtoGTE(io, proto.ID712) {
continue
}
bitset |= 1 << entry.ArmourSlot
}
io.Uint8(&bitset)
for _, flag := range flags {
if bitset&flag != 0 {
damage := int32(0)
for _, entry := range pk.List {
if entry.ArmourSlot == flag {
damage = int32(entry.Damage)
break
}
}
io.Varint32(&damage)
}
}
return
} }
protocol.SliceVarint32Length(io, &pk.List)
} }

View File

@@ -284,7 +284,7 @@ func (pk *StartGame) Marshal(io protocol.IO) {
io.Varint32(&pk.PlatformBroadcastMode) io.Varint32(&pk.PlatformBroadcastMode)
io.Bool(&pk.CommandsEnabled) io.Bool(&pk.CommandsEnabled)
io.Bool(&pk.TexturePackRequired) io.Bool(&pk.TexturePackRequired)
protocol.FuncSlice(io, &pk.GameRules, io.GameRule) protocol.FuncSlice(io, &pk.GameRules, io.GameRuleLegacy)
protocol.SliceUint32Length(io, &pk.Experiments) protocol.SliceUint32Length(io, &pk.Experiments)
io.Bool(&pk.ExperimentsPreviouslyToggled) io.Bool(&pk.ExperimentsPreviouslyToggled)
io.Bool(&pk.BonusChestEnabled) io.Bool(&pk.BonusChestEnabled)

View File

@@ -1,18 +1,13 @@
package proto package proto
import ( import "github.com/sandertv/gophertunnel/minecraft/protocol"
"unsafe"
_ "unsafe"
"github.com/sandertv/gophertunnel/minecraft/protocol"
)
// BiomeDefinition represents a biome definition in the game. This can be a vanilla biome or a completely // BiomeDefinition represents a biome definition in the game. This can be a vanilla biome or a completely
// custom biome. // custom biome.
type BiomeDefinition struct { type BiomeDefinition struct {
// NameIndex represents the index of the biome name in the string list. // NameIndex represents the index of the biome name in the string list.
NameIndex int16 NameIndex int16
// BiomeID is the biome ID. // BiomeID is the biome ID. This is optional and can be empty.
BiomeID int16 BiomeID int16
// Temperature is the temperature of the biome, used for weather, biome behaviours and sky colour. // Temperature is the temperature of the biome, used for weather, biome behaviours and sky colour.
Temperature float32 Temperature float32
@@ -26,6 +21,8 @@ type BiomeDefinition struct {
AshDensity float32 AshDensity float32
// WhiteAshDensity is the density of white ash precipitation visuals. // WhiteAshDensity is the density of white ash precipitation visuals.
WhiteAshDensity float32 WhiteAshDensity float32
// FoliageSnow ...
FoliageSnow float32
// Depth ... // Depth ...
Depth float32 Depth float32
// Scale ... // Scale ...
@@ -43,45 +40,29 @@ type BiomeDefinition struct {
ChunkGeneration protocol.Optional[protocol.BiomeChunkGeneration] ChunkGeneration protocol.Optional[protocol.BiomeChunkGeneration]
} }
// TODO: This will be required to be changed when the structs are modified in future MC updates.
func DowngradeBiomeDefinitions(bd []protocol.BiomeDefinition) []BiomeDefinition {
converted := make([]BiomeDefinition, len(bd))
for i, b := range bd {
ptr := unsafe.Pointer(&b)
converted[i] = *(*BiomeDefinition)(ptr)
}
return converted
}
// TODO: This will be required to be changed when the structs are modified in future MC updates.
func UpgradeBiomeDefinitions(bd []BiomeDefinition) []protocol.BiomeDefinition {
converted := make([]protocol.BiomeDefinition, len(bd))
for i, b := range bd {
ptr := unsafe.Pointer(&b)
converted[i] = *(*protocol.BiomeDefinition)(ptr)
}
return converted
}
func (x *BiomeDefinition) Marshal(r protocol.IO) { func (x *BiomeDefinition) Marshal(r protocol.IO) {
r.Int16(&x.NameIndex) r.Int16(&x.NameIndex)
if IsProtoGTE(r, ID827) { if IsProtoLT(r, ID827) {
r.Int16(&x.BiomeID) var opt protocol.Optional[int16]
} else {
var opt protocol.Optional[uint16]
if x.BiomeID != -1 { if x.BiomeID != -1 {
opt = protocol.Option(uint16(x.BiomeID)) opt = protocol.Option(x.BiomeID)
} }
protocol.OptionalFunc(r, &opt, r.Uint16) protocol.OptionalFunc(r, &opt, r.Int16)
b, _ := opt.Value() x.BiomeID, _ = opt.Value()
x.BiomeID = int16(b) } else {
r.Int16(&x.BiomeID)
} }
r.Float32(&x.Temperature) r.Float32(&x.Temperature)
r.Float32(&x.Downfall) r.Float32(&x.Downfall)
r.Float32(&x.RedSporeDensity) if IsProtoLT(r, ID844) {
r.Float32(&x.BlueSporeDensity) r.Float32(&x.RedSporeDensity)
r.Float32(&x.AshDensity) r.Float32(&x.BlueSporeDensity)
r.Float32(&x.WhiteAshDensity) r.Float32(&x.AshDensity)
r.Float32(&x.WhiteAshDensity)
}
if IsProtoGTE(r, ID844) {
r.Float32(&x.FoliageSnow)
}
r.Float32(&x.Depth) r.Float32(&x.Depth)
r.Float32(&x.Scale) r.Float32(&x.Scale)
r.Int32(&x.MapWaterColour) r.Int32(&x.MapWaterColour)
@@ -91,3 +72,42 @@ func (x *BiomeDefinition) Marshal(r protocol.IO) {
}) })
protocol.OptionalMarshaler(r, &x.ChunkGeneration) 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.FoliageSnow = bd.FoliageSnow
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,
FoliageSnow: x.FoliageSnow,
Depth: x.Depth,
Scale: x.Scale,
MapWaterColour: x.MapWaterColour,
Rain: x.Rain,
Tags: x.Tags,
ChunkGeneration: x.ChunkGeneration,
}
}

View File

@@ -3,6 +3,7 @@ package proto
import "github.com/sandertv/gophertunnel/minecraft/protocol" import "github.com/sandertv/gophertunnel/minecraft/protocol"
const ( const (
ID844 = 844 // v1.21.110
ID827 = 827 // v1.21.100 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

View File

@@ -2,6 +2,7 @@ package proto
import ( import (
"fmt" "fmt"
"github.com/sandertv/gophertunnel/minecraft/protocol" "github.com/sandertv/gophertunnel/minecraft/protocol"
) )

View File

@@ -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

View File

@@ -127,6 +127,8 @@ func convertPacketFunc(pid uint32, cur func() packet.Packet) func() packet.Packe
return func() packet.Packet { return &legacypacket.PlayerList{} } return func() packet.Packet { return &legacypacket.PlayerList{} }
case packet.IDSubChunk: case packet.IDSubChunk:
return func() packet.Packet { return &legacypacket.SubChunk{} } return func() packet.Packet { return &legacypacket.SubChunk{} }
case packet.IDGameRulesChanged:
return func() packet.Packet { return &legacypacket.GameRulesChanged{} }
default: default:
return cur return cur
} }
@@ -295,11 +297,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))
@@ -393,6 +396,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{
@@ -434,12 +438,7 @@ func (p *Protocol) downgradePackets(pks []packet.Packet, conn *minecraft.Conn) [
} }
case *packet.PlayerArmourDamage: case *packet.PlayerArmourDamage:
pks[pkIndex] = &legacypacket.PlayerArmourDamage{ pks[pkIndex] = &legacypacket.PlayerArmourDamage{
Bitset: pk.Bitset, List: pk.List,
HelmetDamage: pk.HelmetDamage,
ChestplateDamage: pk.ChestplateDamage,
LeggingsDamage: pk.LeggingsDamage,
BootsDamage: pk.BootsDamage,
BodyDamage: pk.BodyDamage,
} }
case *packet.SetTitle: case *packet.SetTitle:
pks[pkIndex] = &legacypacket.SetTitle{ pks[pkIndex] = &legacypacket.SetTitle{
@@ -595,6 +594,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:
@@ -722,8 +722,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: proto.DowngradeBiomeDefinitions(pk.BiomeDefinitions), BiomeDefinitions: biomeDefinitions,
StringList: pk.StringList, StringList: pk.StringList,
} }
case *packet.PlayerList: case *packet.PlayerList:
@@ -746,6 +750,10 @@ func (p *Protocol) downgradePackets(pks []packet.Packet, conn *minecraft.Conn) [
Position: pk.Position, Position: pk.Position,
SubChunkEntries: entries, SubChunkEntries: entries,
} }
case *packet.GameRulesChanged:
pks[pkIndex] = &legacypacket.GameRulesChanged{
GameRules: pk.GameRules,
}
} }
} }
@@ -869,11 +877,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))
@@ -967,6 +976,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{
@@ -1008,12 +1018,7 @@ func (p *Protocol) upgradePackets(pks []packet.Packet, conn *minecraft.Conn) []p
} }
case *legacypacket.PlayerArmourDamage: case *legacypacket.PlayerArmourDamage:
pks[pkIndex] = &packet.PlayerArmourDamage{ pks[pkIndex] = &packet.PlayerArmourDamage{
Bitset: pk.Bitset, List: pk.List,
HelmetDamage: pk.HelmetDamage,
ChestplateDamage: pk.ChestplateDamage,
LeggingsDamage: pk.LeggingsDamage,
BootsDamage: pk.BootsDamage,
BodyDamage: pk.BodyDamage,
} }
case *legacypacket.SetTitle: case *legacypacket.SetTitle:
pks[pkIndex] = &packet.SetTitle{ pks[pkIndex] = &packet.SetTitle{
@@ -1157,6 +1162,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:
@@ -1258,8 +1264,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: proto.UpgradeBiomeDefinitions(pk.BiomeDefinitions), BiomeDefinitions: biomeDefinitions,
StringList: pk.StringList, StringList: pk.StringList,
} }
case *legacypacket.PlayerList: case *legacypacket.PlayerList:
@@ -1282,6 +1292,10 @@ func (p *Protocol) upgradePackets(pks []packet.Packet, conn *minecraft.Conn) []p
Position: pk.Position, Position: pk.Position,
SubChunkEntries: entries, SubChunkEntries: entries,
} }
case *legacypacket.GameRulesChanged:
pks[pkIndex] = &packet.GameRulesChanged{
GameRules: pk.GameRules,
}
} }
} }
return pks return pks

View File

@@ -2,7 +2,7 @@ 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/legacyver/proto"
"github.com/akmalfairuz/legacy-version/mapping" "github.com/akmalfairuz/legacy-version/mapping"
) )
@@ -24,12 +24,11 @@ var (
// New649 ... // New649 ...
func New649(dragonflyMapping bool) *Protocol { func New649(dragonflyMapping bool) *Protocol {
itemMapping := mapping.NewItemMapping(requiredItemList649, ItemVersion649) itemMapping := mapping.NewItemMapping(requiredItemList649, ItemVersion649)
blockMapping := mapping.NewBlockMapping(blockStateData649) blockTranslator := lookupOrCreateBlockTranslator(649, BlockVersion649, blockStateData649)
return &Protocol{ return &Protocol{
ver: "1.20.60", ver: "1.20.60",
id: proto.ID649, id: proto.ID649,
blockTranslator: NewBlockTranslator(blockMapping, blockMappingLatest, chunk.NewNetworkPersistentEncoding(blockMapping, BlockVersion649), chunk.NewBlockPaletteEncoding(blockMapping, BlockVersion649), false), blockTranslator: blockTranslator,
itemTranslator: NewItemTranslator(itemMapping, itemMappingLatest(dragonflyMapping), blockMapping, blockMappingLatest), itemTranslator: NewItemTranslator(itemMapping, itemMappingLatest(dragonflyMapping), blockTranslator.BlockMapping(), blockMappingLatest),
} }
} }

View File

@@ -2,7 +2,7 @@ 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/legacyver/proto"
"github.com/akmalfairuz/legacy-version/mapping" "github.com/akmalfairuz/legacy-version/mapping"
) )
@@ -24,12 +24,11 @@ var (
// New662 ... // New662 ...
func New662(dragonflyMapping bool) *Protocol { func New662(dragonflyMapping bool) *Protocol {
itemMapping := mapping.NewItemMapping(requiredItemList662, ItemVersion662) itemMapping := mapping.NewItemMapping(requiredItemList662, ItemVersion662)
blockMapping := mapping.NewBlockMapping(blockStateData662) blockTranslator := lookupOrCreateBlockTranslator(662, BlockVersion662, blockStateData662)
return &Protocol{ return &Protocol{
ver: "1.20.70", ver: "1.20.70",
id: proto.ID662, id: proto.ID662,
blockTranslator: NewBlockTranslator(blockMapping, blockMappingLatest, chunk.NewNetworkPersistentEncoding(blockMapping, BlockVersion662), chunk.NewBlockPaletteEncoding(blockMapping, BlockVersion662), false), blockTranslator: blockTranslator,
itemTranslator: NewItemTranslator(itemMapping, itemMappingLatest(dragonflyMapping), blockMapping, blockMappingLatest), itemTranslator: NewItemTranslator(itemMapping, itemMappingLatest(dragonflyMapping), blockTranslator.BlockMapping(), blockMappingLatest),
} }
} }

View File

@@ -2,7 +2,7 @@ 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/legacyver/proto"
"github.com/akmalfairuz/legacy-version/mapping" "github.com/akmalfairuz/legacy-version/mapping"
) )
@@ -24,12 +24,11 @@ var (
// New671 ... // New671 ...
func New671(dragonflyMapping bool) *Protocol { func New671(dragonflyMapping bool) *Protocol {
itemMapping := mapping.NewItemMapping(requiredItemList671, ItemVersion671) itemMapping := mapping.NewItemMapping(requiredItemList671, ItemVersion671)
blockMapping := mapping.NewBlockMapping(blockStateData671) blockTranslator := lookupOrCreateBlockTranslator(671, BlockVersion671, blockStateData671)
return &Protocol{ return &Protocol{
ver: "1.20.80", ver: "1.20.80",
id: proto.ID671, id: proto.ID671,
blockTranslator: NewBlockTranslator(blockMapping, blockMappingLatest, chunk.NewNetworkPersistentEncoding(blockMapping, BlockVersion671), chunk.NewBlockPaletteEncoding(blockMapping, BlockVersion671), false), blockTranslator: blockTranslator,
itemTranslator: NewItemTranslator(itemMapping, itemMappingLatest(dragonflyMapping), blockMapping, blockMappingLatest), itemTranslator: NewItemTranslator(itemMapping, itemMappingLatest(dragonflyMapping), blockTranslator.BlockMapping(), blockMappingLatest),
} }
} }

View File

@@ -2,7 +2,7 @@ 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/legacyver/proto"
"github.com/akmalfairuz/legacy-version/mapping" "github.com/akmalfairuz/legacy-version/mapping"
) )
@@ -17,12 +17,11 @@ const (
// New685 uses same data as 686 // New685 uses same data as 686
func New685(dragonflyMapping bool) *Protocol { func New685(dragonflyMapping bool) *Protocol {
itemMapping := mapping.NewItemMapping(requiredItemList686, ItemVersion685) itemMapping := mapping.NewItemMapping(requiredItemList686, ItemVersion685)
blockMapping := mapping.NewBlockMapping(blockStateData686) blockTranslator := lookupOrCreateBlockTranslator(685, BlockVersion685, blockStateData686)
return &Protocol{ return &Protocol{
ver: "1.21.0", ver: "1.21.0",
id: proto.ID685, id: proto.ID685,
blockTranslator: NewBlockTranslator(blockMapping, blockMappingLatest, chunk.NewNetworkPersistentEncoding(blockMapping, BlockVersion685), chunk.NewBlockPaletteEncoding(blockMapping, BlockVersion685), false), blockTranslator: blockTranslator,
itemTranslator: NewItemTranslator(itemMapping, itemMappingLatest(dragonflyMapping), blockMapping, blockMappingLatest), itemTranslator: NewItemTranslator(itemMapping, itemMappingLatest(dragonflyMapping), blockTranslator.BlockMapping(), blockMappingLatest),
} }
} }

View File

@@ -2,7 +2,7 @@ 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/legacyver/proto"
"github.com/akmalfairuz/legacy-version/mapping" "github.com/akmalfairuz/legacy-version/mapping"
) )
@@ -23,12 +23,11 @@ var (
func New686(dragonflyMapping bool) *Protocol { func New686(dragonflyMapping bool) *Protocol {
itemMapping := mapping.NewItemMapping(requiredItemList686, ItemVersion686) itemMapping := mapping.NewItemMapping(requiredItemList686, ItemVersion686)
blockMapping := mapping.NewBlockMapping(blockStateData686) blockTranslator := lookupOrCreateBlockTranslator(686, BlockVersion686, blockStateData686)
return &Protocol{ return &Protocol{
ver: "1.21.2", ver: "1.21.2",
id: proto.ID686, id: proto.ID686,
blockTranslator: NewBlockTranslator(blockMapping, blockMappingLatest, chunk.NewNetworkPersistentEncoding(blockMapping, BlockVersion686), chunk.NewBlockPaletteEncoding(blockMapping, BlockVersion686), false), blockTranslator: blockTranslator,
itemTranslator: NewItemTranslator(itemMapping, itemMappingLatest(dragonflyMapping), blockMapping, blockMappingLatest), itemTranslator: NewItemTranslator(itemMapping, itemMappingLatest(dragonflyMapping), blockTranslator.BlockMapping(), blockMappingLatest),
} }
} }

View File

@@ -2,7 +2,7 @@ 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/legacyver/proto"
"github.com/akmalfairuz/legacy-version/mapping" "github.com/akmalfairuz/legacy-version/mapping"
) )
@@ -23,12 +23,11 @@ var (
func New712(dragonflyMapping bool) *Protocol { func New712(dragonflyMapping bool) *Protocol {
itemMapping := mapping.NewItemMapping(requiredItemList712, ItemVersion712) itemMapping := mapping.NewItemMapping(requiredItemList712, ItemVersion712)
blockMapping := mapping.NewBlockMapping(blockStateData712) blockTranslator := lookupOrCreateBlockTranslator(712, BlockVersion712, blockStateData712)
return &Protocol{ return &Protocol{
ver: "1.21.20", ver: "1.21.20",
id: proto.ID712, id: proto.ID712,
blockTranslator: NewBlockTranslator(blockMapping, blockMappingLatest, chunk.NewNetworkPersistentEncoding(blockMapping, BlockVersion712), chunk.NewBlockPaletteEncoding(blockMapping, BlockVersion712), false), blockTranslator: blockTranslator,
itemTranslator: NewItemTranslator(itemMapping, itemMappingLatest(dragonflyMapping), blockMapping, blockMappingLatest), itemTranslator: NewItemTranslator(itemMapping, itemMappingLatest(dragonflyMapping), blockTranslator.BlockMapping(), blockMappingLatest),
} }
} }

View File

@@ -2,7 +2,7 @@ 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/legacyver/proto"
"github.com/akmalfairuz/legacy-version/mapping" "github.com/akmalfairuz/legacy-version/mapping"
) )
@@ -23,12 +23,11 @@ var (
func New729(dragonflyMapping bool) *Protocol { func New729(dragonflyMapping bool) *Protocol {
itemMapping := mapping.NewItemMapping(requiredItemList729, ItemVersion729) itemMapping := mapping.NewItemMapping(requiredItemList729, ItemVersion729)
blockMapping := mapping.NewBlockMapping(blockStateData729) blockTranslator := lookupOrCreateBlockTranslator(729, BlockVersion729, blockStateData729)
return &Protocol{ return &Protocol{
ver: "1.21.30", ver: "1.21.30",
id: proto.ID729, id: proto.ID729,
blockTranslator: NewBlockTranslator(blockMapping, blockMappingLatest, chunk.NewNetworkPersistentEncoding(blockMapping, BlockVersion729), chunk.NewBlockPaletteEncoding(blockMapping, BlockVersion729), false), blockTranslator: blockTranslator,
itemTranslator: NewItemTranslator(itemMapping, itemMappingLatest(dragonflyMapping), blockMapping, blockMappingLatest), itemTranslator: NewItemTranslator(itemMapping, itemMappingLatest(dragonflyMapping), blockTranslator.BlockMapping(), blockMappingLatest),
} }
} }

View File

@@ -2,7 +2,7 @@ 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/legacyver/proto"
"github.com/akmalfairuz/legacy-version/mapping" "github.com/akmalfairuz/legacy-version/mapping"
) )
@@ -23,12 +23,11 @@ var (
func New748(dragonflyMapping bool) *Protocol { func New748(dragonflyMapping bool) *Protocol {
itemMapping := mapping.NewItemMapping(requiredItemList748, ItemVersion748) itemMapping := mapping.NewItemMapping(requiredItemList748, ItemVersion748)
blockMapping := mapping.NewBlockMapping(blockStateData748) blockTranslator := lookupOrCreateBlockTranslator(748, BlockVersion748, blockStateData748)
return &Protocol{ return &Protocol{
ver: "1.21.40", ver: "1.21.40",
id: proto.ID748, id: proto.ID748,
blockTranslator: NewBlockTranslator(blockMapping, blockMappingLatest, chunk.NewNetworkPersistentEncoding(blockMapping, BlockVersion748), chunk.NewBlockPaletteEncoding(blockMapping, BlockVersion748), false), blockTranslator: blockTranslator,
itemTranslator: NewItemTranslator(itemMapping, itemMappingLatest(dragonflyMapping), blockMapping, blockMappingLatest), itemTranslator: NewItemTranslator(itemMapping, itemMappingLatest(dragonflyMapping), blockTranslator.BlockMapping(), blockMappingLatest),
} }
} }

View File

@@ -2,14 +2,14 @@ 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/legacyver/proto"
"github.com/akmalfairuz/legacy-version/mapping" "github.com/akmalfairuz/legacy-version/mapping"
) )
const ( const (
// ItemVersion766 ... // ItemVersion766 ...
ItemVersion766 = 221 ItemVersion766 = 231
// BlockVersion766 ... // BlockVersion766 ...
BlockVersion766 int32 = (1 << 24) | (21 << 16) | (50 << 8) BlockVersion766 int32 = (1 << 24) | (21 << 16) | (50 << 8)
) )
@@ -23,11 +23,11 @@ var (
func New766(dragonflyMapping bool) *Protocol { func New766(dragonflyMapping bool) *Protocol {
itemMapping := mapping.NewItemMapping(requiredItemList766, ItemVersion766) itemMapping := mapping.NewItemMapping(requiredItemList766, ItemVersion766)
blockMapping := mapping.NewBlockMapping(blockStateData766) blockTranslator := lookupOrCreateBlockTranslator(766, BlockVersion766, blockStateData766)
return &Protocol{ return &Protocol{
ver: "1.21.50", ver: "1.21.50",
id: proto.ID766, id: proto.ID766,
blockTranslator: NewBlockTranslator(blockMapping, blockMappingLatest, chunk.NewNetworkPersistentEncoding(blockMapping, BlockVersion766), chunk.NewBlockPaletteEncoding(blockMapping, BlockVersion766), false), blockTranslator: blockTranslator,
itemTranslator: NewItemTranslator(itemMapping, itemMappingLatest(dragonflyMapping), blockMapping, blockMappingLatest), itemTranslator: NewItemTranslator(itemMapping, itemMappingLatest(dragonflyMapping), blockTranslator.BlockMapping(), blockMappingLatest),
} }
} }

View File

@@ -2,14 +2,14 @@ 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/legacyver/proto"
"github.com/akmalfairuz/legacy-version/mapping" "github.com/akmalfairuz/legacy-version/mapping"
) )
const ( const (
// ItemVersion776 ... // ItemVersion776 ...
ItemVersion776 = 241 ItemVersion776 = 231
// BlockVersion776 ... // BlockVersion776 ...
BlockVersion776 int32 = (1 << 24) | (21 << 16) | (60 << 8) BlockVersion776 int32 = (1 << 24) | (21 << 16) | (60 << 8)
) )
@@ -23,12 +23,11 @@ var (
func New776(dragonflyMapping bool) *Protocol { func New776(dragonflyMapping bool) *Protocol {
itemMapping := mapping.NewItemMapping(requiredItemList776, ItemVersion776) itemMapping := mapping.NewItemMapping(requiredItemList776, ItemVersion776)
blockMapping := mapping.NewBlockMapping(blockStateData776) blockTranslator := lookupOrCreateBlockTranslator(776, BlockVersion776, blockStateData776)
return &Protocol{ return &Protocol{
ver: "1.21.60", ver: "1.21.60",
id: proto.ID776, id: proto.ID776,
blockTranslator: NewBlockTranslator(blockMapping, blockMappingLatest, chunk.NewNetworkPersistentEncoding(blockMapping, BlockVersion776), chunk.NewBlockPaletteEncoding(blockMapping, BlockVersion776), false), blockTranslator: blockTranslator,
itemTranslator: NewItemTranslator(itemMapping, itemMappingLatest(dragonflyMapping), blockMapping, blockMappingLatest), itemTranslator: NewItemTranslator(itemMapping, itemMappingLatest(dragonflyMapping), blockTranslator.BlockMapping(), blockMappingLatest),
} }
} }

View File

@@ -2,14 +2,14 @@ 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/legacyver/proto"
"github.com/akmalfairuz/legacy-version/mapping" "github.com/akmalfairuz/legacy-version/mapping"
) )
const ( const (
// ItemVersion786 ... // ItemVersion786 ...
ItemVersion786 = 241 ItemVersion786 = 231
// BlockVersion786 ... // BlockVersion786 ...
BlockVersion786 int32 = (1 << 24) | (21 << 16) | (70 << 8) BlockVersion786 int32 = (1 << 24) | (21 << 16) | (70 << 8)
) )
@@ -22,12 +22,12 @@ var (
) )
func New786(dragonflyMapping bool) *Protocol { func New786(dragonflyMapping bool) *Protocol {
itemMapping786 := mapping.NewItemMapping(requiredItemList786, ItemVersion786) itemMapping := mapping.NewItemMapping(requiredItemList786, ItemVersion786)
blockMapping786 := mapping.NewBlockMapping(blockStateData786) blockTranslator := lookupOrCreateBlockTranslator(786, BlockVersion786, blockStateData786)
return &Protocol{ return &Protocol{
ver: "1.21.70", ver: "1.21.70",
id: proto.ID786, id: proto.ID786,
blockTranslator: NewBlockTranslator(blockMapping786, blockMappingLatest, chunk.NewNetworkPersistentEncoding(blockMapping786, BlockVersion786), chunk.NewBlockPaletteEncoding(blockMapping786, BlockVersion786), false), blockTranslator: blockTranslator,
itemTranslator: NewItemTranslator(itemMapping786, itemMappingLatest(dragonflyMapping), blockMapping786, blockMappingLatest), itemTranslator: NewItemTranslator(itemMapping, itemMappingLatest(dragonflyMapping), blockTranslator.BlockMapping(), blockMappingLatest),
} }
} }

View File

@@ -2,14 +2,14 @@ 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/legacyver/proto"
"github.com/akmalfairuz/legacy-version/mapping" "github.com/akmalfairuz/legacy-version/mapping"
) )
const ( const (
// ItemVersion800 ... // ItemVersion800 ...
ItemVersion800 = 251 ItemVersion800 = 231
// BlockVersion800 ... // BlockVersion800 ...
BlockVersion800 int32 = (1 << 24) | (21 << 16) | (80 << 8) BlockVersion800 int32 = (1 << 24) | (21 << 16) | (80 << 8)
) )
@@ -23,11 +23,11 @@ var (
func New800(dragonflyMapping bool) *Protocol { func New800(dragonflyMapping bool) *Protocol {
itemMapping := mapping.NewItemMapping(requiredItemList800, ItemVersion800) itemMapping := mapping.NewItemMapping(requiredItemList800, ItemVersion800)
blockMapping := mapping.NewBlockMapping(blockStateData800) blockTranslator := lookupOrCreateBlockTranslator(800, BlockVersion800, blockStateData800)
return &Protocol{ return &Protocol{
ver: "1.21.80", ver: "1.21.80",
id: proto.ID800, id: proto.ID800,
blockTranslator: NewBlockTranslator(blockMapping, blockMappingLatest, chunk.NewNetworkPersistentEncoding(blockMapping, BlockVersion800), chunk.NewBlockPaletteEncoding(blockMapping, BlockVersion800), false), blockTranslator: blockTranslator,
itemTranslator: NewItemTranslator(itemMapping, itemMappingLatest(dragonflyMapping), blockMapping, blockMappingLatest), itemTranslator: NewItemTranslator(itemMapping, itemMappingLatest(dragonflyMapping), blockTranslator.BlockMapping(), blockMappingLatest),
} }
} }

View File

@@ -2,14 +2,14 @@ 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/legacyver/proto"
"github.com/akmalfairuz/legacy-version/mapping" "github.com/akmalfairuz/legacy-version/mapping"
) )
const ( const (
// ItemVersion818 ... // ItemVersion818 ...
ItemVersion818 = 261 ItemVersion818 = 231
// BlockVersion818 ... // BlockVersion818 ...
BlockVersion818 int32 = (1 << 24) | (21 << 16) | (90 << 8) BlockVersion818 int32 = (1 << 24) | (21 << 16) | (90 << 8)
) )
@@ -23,11 +23,11 @@ var (
func New818(dragonflyMapping bool) *Protocol { func New818(dragonflyMapping bool) *Protocol {
itemMapping := mapping.NewItemMapping(requiredItemList818, ItemVersion818) itemMapping := mapping.NewItemMapping(requiredItemList818, ItemVersion818)
blockMapping := mapping.NewBlockMapping(blockStateData818) blockTranslator := lookupOrCreateBlockTranslator(818, BlockVersion818, blockStateData818)
return &Protocol{ return &Protocol{
ver: "1.21.90", ver: "1.21.90",
id: proto.ID818, id: proto.ID818,
blockTranslator: NewBlockTranslator(blockMapping, blockMappingLatest, chunk.NewNetworkPersistentEncoding(blockMapping, BlockVersion818), chunk.NewBlockPaletteEncoding(blockMapping, BlockVersion818), false), blockTranslator: blockTranslator,
itemTranslator: NewItemTranslator(itemMapping, itemMappingLatest(dragonflyMapping), blockMapping, blockMappingLatest), itemTranslator: NewItemTranslator(itemMapping, itemMappingLatest(dragonflyMapping), blockTranslator.BlockMapping(), blockMappingLatest),
} }
} }

View File

@@ -3,14 +3,13 @@ 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/legacyver/proto"
"github.com/akmalfairuz/legacy-version/mapping" "github.com/akmalfairuz/legacy-version/mapping"
) )
const ( const (
// ItemVersion819 ... // ItemVersion819 ...
ItemVersion819 = 271 ItemVersion819 = 231
// BlockVersion819 ... // BlockVersion819 ...
BlockVersion819 int32 = (1 << 24) | (21 << 16) | (93 << 8) BlockVersion819 int32 = (1 << 24) | (21 << 16) | (93 << 8)
) )
@@ -24,12 +23,11 @@ var (
func New819(dragonflyMapping bool) *Protocol { func New819(dragonflyMapping bool) *Protocol {
itemMapping := mapping.NewItemMapping(requiredItemList819, ItemVersion819) itemMapping := mapping.NewItemMapping(requiredItemList819, ItemVersion819)
blockMapping := mapping.NewBlockMapping(blockStateData819) blockTranslator := lookupOrCreateBlockTranslator(819, BlockVersion819, blockStateData819)
return &Protocol{ return &Protocol{
ver: "1.21.93", ver: "1.21.90",
id: proto.ID819, id: proto.ID819,
blockTranslator: NewBlockTranslator(blockMapping, blockMappingLatest, chunk.NewNetworkPersistentEncoding(blockMapping, BlockVersion819), chunk.NewBlockPaletteEncoding(blockMapping, BlockVersion819), false), blockTranslator: blockTranslator,
itemTranslator: NewItemTranslator(itemMapping, itemMappingLatest(dragonflyMapping), blockMapping, blockMappingLatest), itemTranslator: NewItemTranslator(itemMapping, itemMappingLatest(dragonflyMapping), blockTranslator.BlockMapping(), blockMappingLatest),
} }
} }

View File

@@ -3,33 +3,31 @@ package legacyver
import ( import (
_ "embed" _ "embed"
"github.com/akmalfairuz/legacy-version/legacyver/proto"
"github.com/akmalfairuz/legacy-version/mapping" "github.com/akmalfairuz/legacy-version/mapping"
) )
const ( const (
// ItemVersion827 ... // ItemVersion827 ...
ItemVersion827 = 271 ItemVersion827 = 241
// BlockVersion827 ... // BlockVersion827 ...
BlockVersion827 int32 = (1 << 24) | (21 << 16) | (100 << 8) BlockVersion827 int32 = (1 << 24) | (21 << 16) | (100 << 8)
) )
var ( var (
//go:embed data/dragonfly_items.json
dragonflyLatestItemList []byte
//go:embed data/required_item_list_827.json //go:embed data/required_item_list_827.json
requiredItemList827 []byte requiredItemList827 []byte
//go:embed data/block_states_827.nbt //go:embed data/block_states_827.nbt
blockStateData827 []byte blockStateData827 []byte
itemMappingLatestPocketMine = mapping.NewItemMapping(requiredItemList827, ItemVersion827)
itemMappingLatestDragonfly = mapping.NewItemMapping(dragonflyLatestItemList, ItemVersion827)
blockMappingLatest = mapping.NewBlockMapping(blockStateData827)
) )
func itemMappingLatest(dragonflyMapping bool) mapping.Item { func New827(dragonflyMapping bool) *Protocol {
if dragonflyMapping { itemMapping := mapping.NewItemMapping(requiredItemList827, ItemVersion827)
return itemMappingLatestDragonfly blockTranslator := lookupOrCreateBlockTranslator(827, BlockVersion827, blockStateData827)
return &Protocol{
ver: "1.21.100",
id: proto.ID827,
blockTranslator: blockTranslator,
itemTranslator: NewItemTranslator(itemMapping, itemMappingLatest(dragonflyMapping), blockTranslator.BlockMapping(), blockMappingLatest),
} }
return itemMappingLatestPocketMine
} }

34
legacyver/v844.go Normal file
View File

@@ -0,0 +1,34 @@
package legacyver
import (
_ "embed"
"github.com/akmalfairuz/legacy-version/mapping"
)
const (
// ItemVersion844 ...
ItemVersion844 = 241
// BlockVersion844 ...
BlockVersion844 int32 = (1 << 24) | (21 << 16) | (110 << 8)
)
var (
//go:embed data/dragonfly_items.json
dragonflyLatestItemList []byte
//go:embed data/required_item_list_844.json
requiredItemList844 []byte
//go:embed data/block_states_844.nbt
blockStateData844 []byte
itemMappingLatestPocketMine = mapping.NewItemMapping(requiredItemList844, ItemVersion844)
itemMappingLatestDragonfly = mapping.NewItemMapping(dragonflyLatestItemList, ItemVersion844)
blockMappingLatest = mapping.NewBlockMapping(blockStateData844)
)
func itemMappingLatest(dragonflyMapping bool) mapping.Item {
if dragonflyMapping {
return itemMappingLatestDragonfly
}
return itemMappingLatestPocketMine
}

View File

@@ -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
}

View File

@@ -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)
} }

View File

@@ -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 {

View File

@@ -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.

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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.