Add support for protocol version 1.21.100 (#12)

This commit is contained in:
Akmal Fairuz
2025-08-13 21:37:46 +07:00
committed by GitHub
parent d3fae5d3be
commit d9d8b0bc75
50 changed files with 9667 additions and 135 deletions

View File

@@ -2,6 +2,7 @@ package legacypacket
import (
"encoding/base64"
"github.com/akmalfairuz/legacy-version/legacyver/proto"
"github.com/samber/lo"
"github.com/sandertv/gophertunnel/minecraft/protocol"
@@ -13,7 +14,7 @@ import (
// accurately recreate the server-side generation in vanilla worlds/servers for increased performance.
type BiomeDefinitionList struct {
// BiomeDefinitions is a list of biomes that are available on the server.
BiomeDefinitions []protocol.BiomeDefinition
BiomeDefinitions []proto.BiomeDefinition
// StringList is a makeshift dictionary implementation Mojang created to try and reduce the size of the
// overall packet. It is a list of common strings that are used in the biome definitions, such as
// biome names, float values or query expressions.

View File

@@ -22,6 +22,8 @@ type CameraAimAssist struct {
TargetMode byte
// Action is the action that should be performed with the aim assist. This is one of the constants above.
Action byte
// ShowDebugRender specifies if debug render should be shown.
ShowDebugRender bool
}
// ID ...
@@ -37,4 +39,7 @@ func (pk *CameraAimAssist) Marshal(io protocol.IO) {
io.Float32(&pk.Distance)
io.Uint8(&pk.TargetMode)
io.Uint8(&pk.Action)
if proto.IsProtoGTE(io, proto.ID827) {
io.Bool(&pk.ShowDebugRender)
}
}

View File

@@ -18,6 +18,8 @@ type CameraInstruction struct {
Target protocol.Optional[protocol.CameraInstructionTarget]
// RemoveTarget can be set to true to remove the current aim assist target.
RemoveTarget protocol.Optional[bool]
// FieldOfView is a camera instruction that updates the field of view for the camera.
FieldOfView protocol.Optional[protocol.CameraInstructionFieldOfView]
}
// ID ...
@@ -33,4 +35,7 @@ func (pk *CameraInstruction) Marshal(io protocol.IO) {
protocol.OptionalMarshaler(io, &pk.Target)
protocol.OptionalFunc(io, &pk.RemoveTarget, io.Bool)
}
if proto.IsProtoGTE(io, proto.ID827) {
protocol.OptionalMarshaler(io, &pk.FieldOfView)
}
}

View File

@@ -41,7 +41,7 @@ func (pk *CorrectPlayerMovePrediction) Marshal(io protocol.IO) {
}
io.Vec3(&pk.Position)
io.Vec3(&pk.Delta)
if proto.IsProtoGTE(io, proto.ID671) {
if proto.IsProtoGTE(io, proto.ID671) && proto.IsProtoLT(io, proto.ID827) {
if pk.PredictionType == packet.PredictionTypeVehicle {
io.Vec2(&pk.Rotation)
if proto.IsProtoGTE(io, proto.ID712) {
@@ -49,6 +49,10 @@ func (pk *CorrectPlayerMovePrediction) Marshal(io protocol.IO) {
}
}
}
if proto.IsProtoGTE(io, proto.ID827) {
io.Vec2(&pk.Rotation)
protocol.OptionalFunc(io, &pk.VehicleAngularVelocity, io.Float32)
}
io.Bool(&pk.OnGround)
io.Varuint64(&pk.Tick)
}

View File

@@ -238,6 +238,8 @@ type StartGame struct {
// its index in the expected block palette. This is useful for servers that wish to support multiple protocol versions
// and custom blocks, but it will result in extra bytes being written for every block in a sub chunk palette.
UseBlockNetworkIDHashes bool
// TickDeathSystemsEnabled specifies if the new tick death systems are enabled.
TickDeathSystemsEnabled bool
// ServerAuthoritativeSound is currently unknown as to what it does.
ServerAuthoritativeSound bool
}
@@ -336,5 +338,8 @@ func (pk *StartGame) Marshal(io protocol.IO) {
io.UUID(&pk.WorldTemplateID)
io.Bool(&pk.ClientSideGeneration)
io.Bool(&pk.UseBlockNetworkIDHashes)
if proto.IsProtoGTE(io, proto.ID827) {
io.Bool(&pk.TickDeathSystemsEnabled)
}
io.Bool(&pk.ServerAuthoritativeSound)
}