1.21.111 support

This commit is contained in:
AkmalFairuz
2025-10-02 15:22:28 +07:00
parent 99a7495fc2
commit bb157beb03
21 changed files with 9715 additions and 99 deletions

11
go.mod
View File

@@ -10,24 +10,25 @@ require (
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.49.0 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-20250819193227-8b4c13bb791b 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/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/df-mc/jsonc v1.0.5 // indirect
github.com/go-jose/go-jose/v4 v4.1.2 // 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.41.0 // indirect golang.org/x/crypto v0.42.0 // indirect
golang.org/x/mod v0.27.0 // indirect golang.org/x/mod v0.27.0 // indirect
golang.org/x/net v0.43.0 // indirect golang.org/x/net v0.44.0 // indirect
golang.org/x/text v0.28.0 // indirect golang.org/x/text v0.29.0 // indirect
) )

14
go.sum
View File

@@ -18,6 +18,8 @@ github.com/df-mc/dragonfly v0.10.6-0.20250817203556-60bcf6b7432b h1:i3nfD4EFsuIZ
github.com/df-mc/dragonfly v0.10.6-0.20250817203556-60bcf6b7432b/go.mod h1:1B3NiEGWj0S9U4QlsL58HPvnmgPlaFCm/pCVWdnrMH0= github.com/df-mc/dragonfly v0.10.6-0.20250817203556-60bcf6b7432b/go.mod h1:1B3NiEGWj0S9U4QlsL58HPvnmgPlaFCm/pCVWdnrMH0=
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/jsonc v1.0.5 h1:O7oh07kbS5AYY+l2Fji6l4h0iHcdjKbxCtK5VlZlLMU=
github.com/df-mc/jsonc v1.0.5/go.mod h1:+Q++JuCE9IKiP8v7sWImdf/RjQX0nfXyfX6PdfTTmc4=
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=
github.com/df-mc/worldupgrader v1.0.18/go.mod h1:tsSOLTRm9mpG7VHvYpAjjZrkRHWmSbKZAm9bOLNnlDk= github.com/df-mc/worldupgrader v1.0.18/go.mod h1:tsSOLTRm9mpG7VHvYpAjjZrkRHWmSbKZAm9bOLNnlDk=
github.com/df-mc/worldupgrader v1.0.19 h1:BnwRe/lVv9IhwRWZK5olvTYNTKWh7rhFdqNPDMnoKFM= github.com/df-mc/worldupgrader v1.0.19 h1:BnwRe/lVv9IhwRWZK5olvTYNTKWh7rhFdqNPDMnoKFM=
@@ -78,6 +80,10 @@ github.com/sandertv/gophertunnel v1.48.1 h1:+DleZznxkYugxEIEFAKN4JDfYSv/zm6//MfY
github.com/sandertv/gophertunnel v1.48.1/go.mod h1:lmRarAmn25V/+QeiUbUDXeA26bEaNlX1wGEM/rj39ew= 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 h1:9FIl4GGYMrFTmBPgkOTUskGWRQHIg4NMpY8JdM6SrCg=
github.com/sandertv/gophertunnel v1.49.0/go.mod h1:lmRarAmn25V/+QeiUbUDXeA26bEaNlX1wGEM/rj39ew= github.com/sandertv/gophertunnel v1.49.0/go.mod h1:lmRarAmn25V/+QeiUbUDXeA26bEaNlX1wGEM/rj39ew=
github.com/sandertv/gophertunnel v1.49.2-0.20251001025512-8f35332755bf h1:bqPdup6V7GyCDsHt7OODSFEhdVR5D8f3ZnavYBA++R4=
github.com/sandertv/gophertunnel v1.49.2-0.20251001025512-8f35332755bf/go.mod h1:WjTvUo02TmvPULY1y5oxxAhZIeH8ew31/LUkSUD6ABw=
github.com/sandertv/gophertunnel v1.50.0 h1:uoXQBWOD823T8snohPjIkFo+pcYrlIalEmcY2S1FUPM=
github.com/sandertv/gophertunnel v1.50.0/go.mod h1:WjTvUo02TmvPULY1y5oxxAhZIeH8ew31/LUkSUD6ABw=
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=
@@ -92,6 +98,8 @@ 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.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 h1:WKYxWedPGCTVVl5+WHSSrOBT0O8lx32+zxmHxijgXp4=
golang.org/x/crypto v0.41.0/go.mod h1:pO5AFd7FA68rFak7rOAGVuygIISepHftHnr8dr6+sUc= golang.org/x/crypto v0.41.0/go.mod h1:pO5AFd7FA68rFak7rOAGVuygIISepHftHnr8dr6+sUc=
golang.org/x/crypto v0.42.0 h1:chiH31gIWm57EkTXpwnqf8qeuMUi0yekh6mT2AvFlqI=
golang.org/x/crypto v0.42.0/go.mod h1:4+rDnOTJhQCx2q7/j6rAN5XDw8kPjeaXEUR2eL94ix8=
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=
@@ -125,10 +133,14 @@ 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.42.0/go.mod h1:FF1RA5d3u7nAYA4z2TkclSCKh68eSXtiFwcWQpPXdt8=
golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE= golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE=
golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg= golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg=
golang.org/x/net v0.44.0 h1:evd8IRDyfNBMBTTY5XRF1vaZlD+EmWx6x8PkhR04H/I=
golang.org/x/net v0.44.0/go.mod h1:ECOoLqd5U3Lhyeyo/QDCEVQ4sNgYsqvCZ722XogGieY=
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=
golang.org/x/oauth2 v0.30.0/go.mod h1:B++QgG3ZKulg6sRPGD/mqlHQs5rB3Ml9erfeDY7xKlU= golang.org/x/oauth2 v0.30.0/go.mod h1:B++QgG3ZKulg6sRPGD/mqlHQs5rB3Ml9erfeDY7xKlU=
golang.org/x/oauth2 v0.31.0 h1:8Fq0yVZLh4j4YA47vHKFTa9Ew5XIrCP8LC6UeNZnLxo=
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.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik= golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik=
@@ -145,6 +157,8 @@ 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.27.0/go.mod h1:1D28KMCvyooCX9hBiosv5Tz/+YLxj0j7XhWjpSUF7CU=
golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng= golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng=
golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU= golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU=
golang.org/x/text v0.29.0 h1:1neNs90w9YzJ9BocxfsQNHKuAT4pkghyXc4nhZ6sJvk=
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

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

View File

@@ -21,6 +21,7 @@ var (
// 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),

Binary file not shown.

File diff suppressed because it is too large Load Diff

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

@@ -21,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 ...
@@ -52,10 +54,15 @@ func (x *BiomeDefinition) Marshal(r protocol.IO) {
} }
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)
@@ -71,10 +78,11 @@ func (x *BiomeDefinition) FromLatest(bd protocol.BiomeDefinition) BiomeDefinitio
x.BiomeID = bd.BiomeID x.BiomeID = bd.BiomeID
x.Temperature = bd.Temperature x.Temperature = bd.Temperature
x.Downfall = bd.Downfall x.Downfall = bd.Downfall
x.RedSporeDensity = bd.RedSporeDensity //x.RedSporeDensity = bd.RedSporeDensity
x.BlueSporeDensity = bd.BlueSporeDensity //x.BlueSporeDensity = bd.BlueSporeDensity
x.AshDensity = bd.AshDensity //x.AshDensity = bd.AshDensity
x.WhiteAshDensity = bd.WhiteAshDensity //x.WhiteAshDensity = bd.WhiteAshDensity
x.FoliageSnow = bd.FoliageSnow
x.Depth = bd.Depth x.Depth = bd.Depth
x.Scale = bd.Scale x.Scale = bd.Scale
x.MapWaterColour = bd.MapWaterColour x.MapWaterColour = bd.MapWaterColour
@@ -86,19 +94,20 @@ func (x *BiomeDefinition) FromLatest(bd protocol.BiomeDefinition) BiomeDefinitio
func (x *BiomeDefinition) ToLatest() protocol.BiomeDefinition { func (x *BiomeDefinition) ToLatest() protocol.BiomeDefinition {
return protocol.BiomeDefinition{ return protocol.BiomeDefinition{
NameIndex: x.NameIndex, NameIndex: x.NameIndex,
BiomeID: x.BiomeID, BiomeID: x.BiomeID,
Temperature: x.Temperature, Temperature: x.Temperature,
Downfall: x.Downfall, Downfall: x.Downfall,
RedSporeDensity: x.RedSporeDensity, //RedSporeDensity: x.RedSporeDensity,
BlueSporeDensity: x.BlueSporeDensity, //BlueSporeDensity: x.BlueSporeDensity,
AshDensity: x.AshDensity, //AshDensity: x.AshDensity,
WhiteAshDensity: x.WhiteAshDensity, //WhiteAshDensity: x.WhiteAshDensity,
Depth: x.Depth, FoliageSnow: x.FoliageSnow,
Scale: x.Scale, Depth: x.Depth,
MapWaterColour: x.MapWaterColour, Scale: x.Scale,
Rain: x.Rain, MapWaterColour: x.MapWaterColour,
Tags: x.Tags, Rain: x.Rain,
ChunkGeneration: x.ChunkGeneration, 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

@@ -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
} }
@@ -436,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{
@@ -753,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,
}
} }
} }
@@ -1017,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{
@@ -1296,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

@@ -9,7 +9,7 @@ import (
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)
) )

View File

@@ -9,7 +9,7 @@ import (
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)
) )

View File

@@ -9,7 +9,7 @@ import (
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)
) )

View File

@@ -9,7 +9,7 @@ import (
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)
) )

View File

@@ -9,7 +9,7 @@ import (
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)
) )

View File

@@ -9,7 +9,7 @@ import (
const ( const (
// ItemVersion819 ... // ItemVersion819 ...
ItemVersion819 = 261 ItemVersion819 = 231
// BlockVersion819 ... // BlockVersion819 ...
BlockVersion819 int32 = (1 << 24) | (21 << 16) | (90 << 8) BlockVersion819 int32 = (1 << 24) | (21 << 16) | (90 << 8)
) )

View File

@@ -3,32 +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
}