updates for 1.21.100 support

This commit is contained in:
ethaniccc
2025-08-08 00:29:41 -04:00
parent d3fae5d3be
commit 6479ff677e
16 changed files with 9433 additions and 68 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

@@ -21,6 +21,7 @@ type CorrectPlayerMovePrediction struct {
Delta mgl32.Vec3
// Rotation is the rotation of the player at the tick written in the field below. It is only included if
// PredictionType is PredictionTypeVehicle.
// NOTE: As of 1.21.100, this field is also used for player rotations, and is not only set for vehicles.
Rotation mgl32.Vec2
// VehicleAngularVelocity is the angular velocity of the vehicle that the rider is riding.
VehicleAngularVelocity protocol.Optional[float32]
@@ -41,12 +42,12 @@ func (pk *CorrectPlayerMovePrediction) Marshal(io protocol.IO) {
}
io.Vec3(&pk.Position)
io.Vec3(&pk.Delta)
if proto.IsProtoGTE(io, proto.ID671) {
if pk.PredictionType == packet.PredictionTypeVehicle {
io.Vec2(&pk.Rotation)
if proto.IsProtoGTE(io, proto.ID712) {
protocol.OptionalFunc(io, &pk.VehicleAngularVelocity, io.Float32)
}
if (proto.IsProtoGTE(io, proto.ID671) && proto.IsProtoLT(io, proto.ID827) && pk.PredictionType == packet.PredictionTypeVehicle) ||
proto.IsProtoGTE(io, proto.ID827) {
io.Vec2(&pk.Rotation)
if proto.IsProtoGTE(io, proto.ID712) {
protocol.OptionalFunc(io, &pk.VehicleAngularVelocity, io.Float32)
}
}
io.Bool(&pk.OnGround)

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