[codex] 为各玩家姿态添加独立相机旋转设置#209
Open
rsdadada wants to merge 3 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
总体思路
这个 PR 将绑定模式中的“姿态俯仰修正”改为“按玩家姿态保存完整相机旋转”。旧实现只在基础 pitch 上叠加游泳/爬行 pitch adjustment,容易让配置者误解;现在
STAND、SNEAKING、SWIMMING、CRAWLING四种姿态各自拥有独立的pitch/yaw/roll,运行时、热键调整、模型视图预览和导入导出都围绕同一个姿态枚举工作。配置兼容策略是:导出的绑定配置版本升级到
0.7.8,直接写入四种姿态的完整旋转;旧0.7.3导入仍受支持,并把旧的单组pitch/yaw/roll复制到全部姿态,避免旧配置导入后姿态间出现意外差异。代码增改明细
common/build.gradle.ktsTest任务启用useJUnitPlatform(),使 common 模块可以运行新增单元测试。common/src/main/java/com/xtracr/realcamera/KeyMappings.javaCameraPosture。client.player计算当前姿态,并把姿态传给ModConfig的对应调整方法。roll/yaw/pitch,不再只修改通用旋转值。common/src/main/java/com/xtracr/realcamera/RealCameraCore.javaCameraPosture.from(entity)获取当前姿态。BindResult.computeCamera(false, posture),使运行时相机直接使用当前姿态的完整旋转。common/src/main/java/com/xtracr/realcamera/api/BindResult.javaCameraPosture。computeCamera(boolean mirrored)保留,并默认使用CameraPosture.STAND。computeCamera(boolean mirrored, CameraPosture posture)。OffsetConfig按姿态读取,不再传入或叠加 pitch adjustment。common/src/main/java/com/xtracr/realcamera/config/CameraPosture.javaSTAND、SNEAKING、SWIMMING、CRAWLING。from(Entity):非玩家或默认状态返回STAND;玩家按游泳、视觉爬行、潜行、站立的顺序判定。common/src/main/java/com/xtracr/realcamera/config/ConfigScreen.javacommon/src/main/java/com/xtracr/realcamera/config/ModConfig.javaadjustOffsetX/Y/Z分别增加带CameraPosture参数的重载,原无姿态参数的方法默认使用STAND。x/y/z并在同一分支 clamp。OffsetConfig.adjustRoll/adjustYaw/adjustPitch(posture, delta),让热键调整写入当前姿态的独立旋转。common/src/main/java/com/xtracr/realcamera/config/OffsetConfig.javascale/x/y/z和站立姿态的pitch/yaw/roll字段。sneakingPitch/Yaw/Roll、swimmingPitch/Yaw/Roll、crawlingPitch/Yaw/Roll。pitch/yaw/roll复制到四种姿态。clamp()现在 wrap 四种姿态的全部旋转角。pitch/yaw/roll(CameraPosture)按姿态读取旋转。setRotation(CameraPosture, pitch, yaw, roll)按姿态写入整组旋转并 clamp。adjustPitch/adjustYaw/adjustRoll(CameraPosture, value),只调整对应姿态的单个旋转轴。write(FriendlyByteBuf)改为依次写入四种姿态的pitch/yaw/roll,移除旧的游泳/爬行 pitch adjustment 写法。common/src/main/java/com/xtracr/realcamera/config/serialization/ConfigSerializer.javaConfigSerializer708。0.7.3改为0.7.8。0.7.3与0.7.8。common/src/main/java/com/xtracr/realcamera/config/serialization/ConfigSerializer708.java0.7.8绑定配置反序列化器。readOffsetConfig在scale/x/y/z后读取四种姿态各自的pitch/yaw/roll。OffsetConfig,保持目标配置、绑定轴配置、禁用配置、UV 矩形读取逻辑完整。common/src/main/java/com/xtracr/realcamera/gui/ModelAnalyser.javaCameraPosture。captureModel和内部computeRecord的额外参数从float pitchAdjustment改为CameraPosture posture。BindResult.computeCamera(true, posture),使用当前预览姿态的完整旋转。common/src/main/java/com/xtracr/realcamera/gui/ModelViewScreen.javapitch/yaw/roll数值控件;站立继续使用原三组控件。widgetPairs扩展为包含四种姿态的全部旋转控件,使滑块/输入框切换与归零按钮覆盖全部姿态值。pitch/yaw/roll三个控件。STAND并刷新控件。CameraPosture,不再传 pitch adjustment。loadBindTarget从OffsetConfig中按四种姿态读取全部旋转值并填入控件。genBindTarget从四种姿态的控件生成新格式OffsetConfig。currentPitchPair/currentYawPair/currentRollPair/previewPosture辅助方法。common/src/main/resources/assets/realcamera/lang/en_us.jsonPitch。standPosture、sneakingPosture,并保留/使用游泳、爬行姿态文案。common/src/main/resources/assets/realcamera/lang/zh_cn.jsonstandPosture、sneakingPosture,并保留/使用游泳、爬行姿态文案。common/src/main/resources/assets/realcamera/lang/zh_hk.jsoncommon/src/main/resources/assets/realcamera/lang/zh_tw.jsoncommon/src/test/java/com/xtracr/realcamera/config/OffsetConfigTest.javacommon/src/test/java/com/xtracr/realcamera/config/serialization/ConfigSerializer703Test.java0.7.3绑定配置读取时会把旧pitch/yaw/roll复制到每一种CameraPosture。验证
./gradlew.bat build