Add missing translation

This commit is contained in:
AkmalFairuz
2025-01-01 01:41:54 +07:00
parent 0de5415f05
commit a4b14835de
14 changed files with 223 additions and 108 deletions

View File

@@ -0,0 +1,40 @@
package legacypacket
import (
"github.com/akmalfairuz/legacy-version/legacyver/proto"
"github.com/go-gl/mathgl/mgl32"
"github.com/sandertv/gophertunnel/minecraft/protocol"
"github.com/sandertv/gophertunnel/minecraft/protocol/packet"
)
// CameraAimAssist is sent by the server to the client to set up aim assist for the client's camera.
type CameraAimAssist struct {
// Preset is the ID of the preset that has previously been defined in the CameraAimAssistPresets packet.
Preset string
// Angle is the maximum angle around the playes's cursor that the aim assist should check for a target,
// if TargetMode is set to protocol.AimAssistTargetModeAngle.
Angle mgl32.Vec2
// Distance is the maximum distance from the player's cursor should check for a target, if TargetMode is
// set to protocol.AimAssistTargetModeDistance.
Distance float32
// TargetMode is the mode that the camera should use for detecting targets. This is currently one of
// protocol.AimAssistTargetModeAngle or protocol.AimAssistTargetModeDistance.
TargetMode byte
// Action is the action that should be performed with the aim assist. This is one of the constants above.
Action byte
}
// ID ...
func (*CameraAimAssist) ID() uint32 {
return packet.IDCameraAimAssist
}
func (pk *CameraAimAssist) Marshal(io protocol.IO) {
if proto.IsProtoGTE(io, proto.ID766) {
io.String(&pk.Preset)
}
io.Vec2(&pk.Angle)
io.Float32(&pk.Distance)
io.Uint8(&pk.TargetMode)
io.Uint8(&pk.Action)
}

View File

@@ -0,0 +1,23 @@
package legacypacket
import (
"github.com/akmalfairuz/legacy-version/legacyver/proto"
"github.com/sandertv/gophertunnel/minecraft/protocol"
"github.com/sandertv/gophertunnel/minecraft/protocol/packet"
)
// CameraPresets gives the client a list of custom camera presets.
type CameraPresets struct {
// Presets is a list of camera presets that can be used by other cameras. The order of this list is important because
// the index of presets is used as a pointer in the CameraInstruction packet.
Presets []proto.CameraPreset
}
// ID ...
func (*CameraPresets) ID() uint32 {
return packet.IDCameraPresets
}
func (pk *CameraPresets) Marshal(io protocol.IO) {
protocol.Slice(io, &pk.Presets)
}

View File

@@ -7,102 +7,6 @@ import (
"github.com/sandertv/gophertunnel/minecraft/protocol/packet"
)
const PlayerAuthInputBitsetSize = 65
const (
InputFlagAscend = iota
InputFlagDescend
InputFlagNorthJump
InputFlagJumpDown
InputFlagSprintDown
InputFlagChangeHeight
InputFlagJumping
InputFlagAutoJumpingInWater
InputFlagSneaking
InputFlagSneakDown
InputFlagUp
InputFlagDown
InputFlagLeft
InputFlagRight
InputFlagUpLeft
InputFlagUpRight
InputFlagWantUp
InputFlagWantDown
InputFlagWantDownSlow
InputFlagWantUpSlow
InputFlagSprinting
InputFlagAscendBlock
InputFlagDescendBlock
InputFlagSneakToggleDown
InputFlagPersistSneak
InputFlagStartSprinting
InputFlagStopSprinting
InputFlagStartSneaking
InputFlagStopSneaking
InputFlagStartSwimming
InputFlagStopSwimming
InputFlagStartJumping
InputFlagStartGliding
InputFlagStopGliding
InputFlagPerformItemInteraction
InputFlagPerformBlockActions
InputFlagPerformItemStackRequest
InputFlagHandledTeleport
InputFlagEmoting
InputFlagMissedSwing
InputFlagStartCrawling
InputFlagStopCrawling
InputFlagStartFlying
InputFlagStopFlying
InputFlagClientAckServerData
InputFlagClientPredictedVehicle
InputFlagPaddlingLeft
InputFlagPaddlingRight
InputFlagBlockBreakingDelayEnabled
InputFlagHorizontalCollision
InputFlagVerticalCollision
InputFlagDownLeft
InputFlagDownRight
InputFlagStartUsingItem
InputFlagCameraRelativeMovementEnabled
InputFlagRotControlledByMoveDirection
InputFlagStartSpinAttack
InputFlagStopSpinAttack
InputFlagIsHotbarTouchOnly
InputFlagJumpReleasedRaw
InputFlagJumpPressedRaw
InputFlagJumpCurrentRaw
InputFlagSneakReleasedRaw
InputFlagSneakPressedRaw
InputFlagSneakCurrentRaw
)
const (
InputModeMouse = iota + 1
InputModeTouch
InputModeGamePad
InputModeMotionController
)
const (
PlayModeNormal = iota
PlayModeTeaser
PlayModeScreen
PlayModeViewer
PlayModeReality
PlayModePlacement
PlayModeLivingRoom
PlayModeExitLevel
PlayModeExitLevelLivingRoom
PlayModeNumModes
)
const (
InteractionModelTouch = iota
InteractionModelCrosshair
InteractionModelClassic
)
// PlayerAuthInput is sent by the client to allow for server authoritative movement. It is used to synchronise
// the player input with the position server-side.
// The client sends this packet when the ServerAuthoritativeMovementMode field in the StartGame packet is set
@@ -172,7 +76,7 @@ func (pk *PlayerAuthInput) Marshal(io protocol.IO) {
io.Vec2(&pk.MoveVector)
io.Float32(&pk.HeadYaw)
if proto.IsProtoGTE(io, proto.ID766) {
io.Bitset(&pk.InputData, PlayerAuthInputBitsetSize)
io.Bitset(&pk.InputData, packet.PlayerAuthInputBitsetSize)
} else {
io.Bitset(&pk.InputData, 64)
}
@@ -184,19 +88,19 @@ func (pk *PlayerAuthInput) Marshal(io protocol.IO) {
io.Varuint64(&pk.Tick)
io.Vec3(&pk.Delta)
if pk.InputData.Load(InputFlagPerformItemInteraction) {
if pk.InputData.Load(packet.InputFlagPerformItemInteraction) {
io.PlayerInventoryAction(&pk.ItemInteractionData)
}
if pk.InputData.Load(InputFlagPerformItemStackRequest) {
if pk.InputData.Load(packet.InputFlagPerformItemStackRequest) {
protocol.Single(io, &pk.ItemStackRequest)
}
if pk.InputData.Load(InputFlagPerformBlockActions) {
if pk.InputData.Load(packet.InputFlagPerformBlockActions) {
protocol.SliceVarint32Length(io, &pk.BlockActions)
}
if pk.InputData.Load(InputFlagClientPredictedVehicle) {
if pk.InputData.Load(packet.InputFlagClientPredictedVehicle) {
io.Vec2(&pk.VehicleRotation)
io.Varint64(&pk.ClientPredictedVehicle)
}