diff --git a/.github/ISSUE_TEMPLATE/bug_report_cn.yml b/.github/ISSUE_TEMPLATE/bug_report_cn.yml index 6e50b14e..62cef475 100644 --- a/.github/ISSUE_TEMPLATE/bug_report_cn.yml +++ b/.github/ISSUE_TEMPLATE/bug_report_cn.yml @@ -7,42 +7,56 @@ body: - type: markdown attributes: value: | - 请确保您使用的是最新版的RC,您反馈的bug很可能已经在更新版本中修复 + 请确保您使用的是最新版的RealCamera,您反馈的bug很可能已经在更新版本中修复 (查看尾缀是否与最新工件相同) 在反馈bug前,请先尝试搜索是否已有相似的问题,请不要重复打开相同的issue 所有有关YSM的问题,请您优先寻求他人的帮助,或者观看配置模型教程 - 而不是直接在issue中提问。 + 而不是直接在issue中提问 - type: checkboxes id: preliminary attributes: label: 我已确认 ... options: - - label: 我正在使用最新版的RC + - label: 我正在使用最新版的RealCamera required: true - - label: 无法在关闭主要功能时复现 + - label: issues里没有相关的问题 required: true - type: input - id: minecraft-version-loader + id: minecraft-version attributes: - label: Minecraft版本和加载器 + label: Minecraft版本 description: | - 请填写游戏版本与所使用的加载器. + 你所使用的Minecraft的版本. - 你可以在游戏主界面作下角或者游戏启动时的日志开头等地方找到. + 你可以在游戏主界面左下角或者游戏启动时的日志开头等地方找到. validations: required: true + - type: checkboxes + id: bug-type + attributes: + label: 问题类型 + options: + - label: 开启主功能时出现bug + required: false + - label: 与其他模组的兼容问题 + required: false + - label: 在fabric端出现 + required: false + - label: 在(neo)forge端出现 + required: false + - type: textarea id: incompatible-mods attributes: label: 不兼容的mod description: >- 和bug相关的模组 -
请在反馈问题前尝试尽可能移除不相干的模组的情况下复现bug - placeholder: 'Mods list here' +
请在反馈问题前移除所有不相干的模组的情况下复现bug + placeholder: '与问题有关的模组列表' render: 'raw' validations: required: true @@ -52,7 +66,8 @@ body: attributes: label: 错误描述 description: >- - 请尽可能详细的描述遇到的问题. + 请尽可能详细的描述遇到的问题 +
同时也请务必携带复现时的视频或截图,这对于我们理解问题非常有帮助
越清晰和详尽的描述会使该bug的处理优先级更高 validations: required: true @@ -62,9 +77,9 @@ body: attributes: label: 复现步骤 placeholder: | - 1. Join the game... + 1. 进入游戏... - 2. Change some settings... + 2. 做出某些改变... 3. ... @@ -73,7 +88,10 @@ body: attributes: label: 日志和崩溃报告 description: >- - 你可以在/logs/lastest.log 和 /crash-report 中找到错误报告,或者使用启动器的导出功能 + 如果为非崩溃问题,请不要上传日志,这样会不利于我们理解问题 +
你可以在/logs/lastest.log 和 /crash-report 中找到错误报告,或者使用启动器的导出功能
你可以日志上传到类似 https://paste.ubuntu.com/ 或者 https://mclo.gs/ 的网站并在此贴出链接 -
**请不要在此此处直接粘贴大段的日志文本!!** +
**请不要在此处直接粘贴大段的日志文本!!!** +
**请不要在此处直接粘贴大段的日志文本!!!** +
**请不要在此处直接粘贴大段的日志文本!!!** placeholder: '把日志文件往这丢或者使用外部链接' \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/bug_report_en.yml b/.github/ISSUE_TEMPLATE/bug_report_en.yml index 2be682d9..92e716d9 100644 --- a/.github/ISSUE_TEMPLATE/bug_report_en.yml +++ b/.github/ISSUE_TEMPLATE/bug_report_en.yml @@ -12,7 +12,7 @@ body: Before reporting a bug, please search for similar issues first and avoid opening duplicate issues For all YSM-related questions, please seek help from others or watch configuration model tutorials first - instead of asking directly in the issue. + instead of asking directly in the issue - type: checkboxes id: preliminary @@ -21,27 +21,41 @@ body: options: - label: I am using the latest version of RealCamera required: true - - label: Unable to reproduce when main feature is disabled + - label: No related issues found in the issue tracker. required: true + - label: Appears on Fabric + required: false + - label: Appears on (Neo)Forge + required: false - type: input - id: minecraft-version-loader + id: minecraft-version attributes: - label: Minecraft Version and Loader + label: Minecraft Version description: | - Please specify the game version and your mod loader. + The Minecraft version you are using. You can find them at the corner of main menu or in the log while startup. validations: required: true + - type: checkboxes + id: bug-type + attributes: + label: Question Type + options: + - label: Bug occurs when enabling main feature + required: false + - label: Incompatibility with other mods + required: false + - type: textarea id: incompatible-mods attributes: label: Incompatible Mods description: >- - The mods related to the bug. -
Try to remove unrelated plugins and mods before reporting + The mods related to the bug +
Reproduce the bug with all unrelated mods removed before reporting placeholder: 'Mods list here' render: 'raw' validations: @@ -52,7 +66,8 @@ body: attributes: label: Bug Description description: >- - Please describe the issue you encountered in as much detail as possible. + Please describe the issue you encountered in as much detail as possible +
Please also attach screenshots or reproduction videos, as they help us diagnose the problem effectively
Clearer and more detailed descriptions will receive higher processing priority validations: required: true @@ -73,7 +88,10 @@ body: attributes: label: Logs & Crash Reports description: >- - You can find error reports in /logs/latest.log and /crash-reports, or use the launcher's export function + If your issue is not a crash, please do not upload log files, as they will hinder our understanding of the problem +
You can find error reports in /logs/latest.log and /crash-reports, or use the launcher's export function
You can upload logs to sites like https://paste.ubuntu.com/ or https://mclo.gs/ and post the link here -
**DO NOT PASTE LARGE LOGS DIRECTLY HERE!!** +
**DO NOT PASTE LARGE LOGS DIRECTLY HERE!!!** +
**DO NOT PASTE LARGE LOGS DIRECTLY HERE!!!** +
**DO NOT PASTE LARGE LOGS DIRECTLY HERE!!!** placeholder: 'Drag log file here or use external link' \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/feature_request_cn.yml b/.github/ISSUE_TEMPLATE/feature_request_cn.yml new file mode 100644 index 00000000..f960b8d0 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request_cn.yml @@ -0,0 +1,43 @@ +name: 新功能建议 +description: 为我们提供新的想法 +title: "[new feature]:" +labels: [ "new feature" ] +body: + - type: markdown + attributes: + value: | + 感谢您花时间提出新的功能想法! + 请确保最新版本内没有这个功能! + + - type: textarea + id: feature-description + attributes: + label: 这个功能是什么? + description: 请清晰地描述您希望添加的功能 + placeholder: 我希望... + validations: + required: true + + - type: textarea + id: problem-and-solution + attributes: + label: 这个功能可以解决什么问题? + description: 请详细说明其作用 + placeholder: 这个功能可以帮助解决... + validations: + required: true + + - type: textarea + id: ideal-solution + attributes: + label: 这个功能理想中的解决方案是什么样的? + description: 例如新的按钮应该在何处,哪里需要新的配置选项 + placeholder: 我希望... + validations: + required: true + + - type: textarea + id: additional-context + attributes: + label: 其他信息 + description: 任何关于功能的上下文或截图 \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/feature_request_en.yml b/.github/ISSUE_TEMPLATE/feature_request_en.yml new file mode 100644 index 00000000..0ae65664 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request_en.yml @@ -0,0 +1,43 @@ +name: New Feature Request +description: Suggest an idea for this project +title: "[new feature]: " +labels: [ "new feature" ] +body: + - type: markdown + attributes: + value: | + Thanks for taking the time to suggest a new feature! + Check the latest build to confirm the feature is missing. + + - type: textarea + id: feature-description + attributes: + label: What is this feature about? + description: A clear and concise description of what the feature is. + placeholder: I would like to... + validations: + required: true + + - type: textarea + id: problem-and-solution + attributes: + label: What problem does this feature solve? + description: Please elaborate on its purpose + placeholder: This feature helps resolve... + validations: + required: true + + - type: textarea + id: ideal-solution + attributes: + label: What does your ideal solution look like? + description: For example, where new buttons or config options should be placed + placeholder: I would like... + validations: + required: true + + - type: textarea + id: additional-context + attributes: + label: Additional context + description: Any relevant information or screenshots regarding the feature \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 525427ad..cab7ad04 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,6 +3,7 @@ name: Build on: pull_request: paths-ignore: + - '**/ISSUE_TEMPLATE/**' - '**/lang/**' - '**.md' - 'LICENSE' diff --git a/README.md b/README.md index 82d22a72..33594776 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ ### [中文](README_ZH.md) Make the camera more realistic in the first-person view. -Supported versions: 1.18.2 - 1.20.4 Forge, 1.18.2 - 26.1 Fabric, 1.21 - 26.1 NeoForge. +Supported versions: 1.18.2 - 1.20.4 Forge, 1.18.2 - 26.2 Fabric, 1.21 - 26.2 NeoForge. Download the mod from [Releases](https://github.com/xTracr/RealCamera/releases), [Modrinth](https://modrinth.com/mod/real-camera) or [CurseForge](https://curseforge.com/minecraft/mc-mods/real-camera) Snapshots are [here](https://github.com/xTracr/RealCamera/actions/workflows/build.yml) @@ -12,7 +12,7 @@ Snapshots are [here](https://github.com/xTracr/RealCamera/actions/workflows/buil * Bind the camera to a specific part of the body. * Customize the position and rotation of the camera. * Render player model in first-person perspective. -* Use F6 to toggle the feature on or off and other hotkeys to adjust the camera. +* Use 「F6」 to toggle the feature on or off and other hotkeys to adjust the camera. * Configure these features in the Config Screen (Cloth Config required) and the Model View Screen (0.6+). ### Configuration (0.6+) @@ -25,17 +25,27 @@ Snapshots are [here](https://github.com/xTracr/RealCamera/actions/workflows/buil * From the top right button, enter the `Preview` section, where you can see the relative relationship between the camera and the model and make certain adjustments (you can also adjust through key bindings). * ![gui_preview](https://cdn.modrinth.com/data/fYYSAh4R/images/44c87a6f1750f8d1b03422120e6042d1098896cb.png) * Enter a name and save. +* ~~If you have difficulty configuring the settings, you can also enable `Mod Settings > Binding Mode > Legacy Binding Mode` +
Note: This setting is exclusive to vanilla Minecraft.~~ #### Tips * Configs can have their priority adjusted - higher priority configs appear higher in the right-side list +* In the mod settings, you can manually switch between available configurations by modifying the configuration index. You can also set it to a non-zero value to lock the active configuration +* When the main feature is enabled, hover over the configuration entries. The one annotated with `Current Config` is the configuration currently in use * Disable depth in `Preview` section to hide models blocking the view -* About `Disable` section (current version still rough, complex operations): - * When texture ID field is empty, use Left Alt+Left Click to select texture - * Model parts contained by blue boxes won't be rendered - * Left-click drag to select in texture view, other keys cancel selection - * Left Alt+Left Click quickly selects hovered parts - * In `All` mode, entire texture's model won't render (blue box containing the texture in left panel indicates this) +* About `Disable` section: + * When texture ID field is empty, use 「Left Alt + Left Click」 to select a texture + * Selection modes: + * Single & Multiple selection: Press 「Left Alt + Left Click」 to select the faces to disable + * Range selection: Press 「Left Alt + Left Click」 to confirm the selection area, and use 「Alt + Scroll Wheel」 to adjust the size of the selection area + * In the left texture view of the player rendering area: + * Press 「Left Click」 to start/end drag selection, press any other key to cancel the selection + * Faces selected via drag selection have the same effect as faces disabled via Multiple selection + * Notably, disabling faces this way is generally more performance-efficient than other methods + * Disable modes: + * In `part` mode, selected faces will not be rendered (you can preview the effect by toggling off the visibility of the disable configuration on the right pane) + * In `All` mode, entire texture's model won't render (blue box containing the texture in left panel indicates this) * ![gui_disable](https://cdn.modrinth.com/data/fYYSAh4R/images/b49ac4da6bf8a59f13c7e93ca1ef76b73e5d23b4.png) ## Dependencies @@ -55,10 +65,11 @@ Snapshots are [here](https://github.com/xTracr/RealCamera/actions/workflows/buil * Why can't i open the Config Screen? * Please downlowd [Cloth Config API](https://modrinth.com/mod/cloth-config) * Why does it show binding failed when use YSM models? - * Snapshot 0.6.15 "try" to fix problems, but it didn't fix completely - * If Minecraft version is 1.20.1, then bind upward vector to head left (or right) side, and set roll angle to 90 (or -90) in preview section -* Why does the head of YSM model disappear when in the Model View Screen? - * You downloaded Better Combat, just put it away + * Snapshot 0.6.15 "try" to fix problems, but it didn't fully fix completely + * When your model rotates to a specific angle, the position you bound may disappear due to YSM's `face culling feature`, resulting in binding failure + * You can alleviate this problem by increasing the `Bind Result Retention Frames` +* Why does the disabled texture appear when i downloaded Better Combat and attack? + * Open settings of Better Combat and change Auto to False in First person player animation ### Compatibility diff --git a/README_ZH.md b/README_ZH.md index 6f2ae5d0..64ae27ad 100644 --- a/README_ZH.md +++ b/README_ZH.md @@ -3,7 +3,7 @@ ### [English](README.md) 使第一人称视角下的摄像头更加真实。 -支持的版本: 1.18.2 - 1.20.4 Forge,1.18.2 - 26.1 Fabric,1.21 - 26.1 NeoForge +支持的版本: 1.18.2 - 1.20.4 Forge,1.18.2 - 26.2 Fabric,1.21 - 26.2 NeoForge 从[Releases](https://github.com/xTracr/RealCamera/releases)、[Modrinth](https://modrinth.com/mod/real-camera)或[CurseForge](https://curseforge.com/minecraft/mc-mods/real-camera)下载 快照版在[这里](https://github.com/xTracr/RealCamera/actions/workflows/build.yml) @@ -12,7 +12,7 @@ * 将摄像头绑定到身体的特定部位 * 自定义摄像头的位置和旋转角度 * 在第一人称视角下渲染玩家模型 -* 按下F6来开关,另外一些键来调整摄像头 +* 按下「F6」来开关,另外一些键来调整摄像头 * 在配置界面(需要Cloth Config)和模型视图(0.6+)界面,配置以上特性 ### 配置(0.6+) @@ -25,17 +25,27 @@ * 从右上角的按钮进入`预览`界面,在这里可以看到摄像头与模型的相对关系,并进行一定的调整(也可以通过按键绑定调整) * ![gui_preview](https://cdn.modrinth.com/data/fYYSAh4R/images/44c87a6f1750f8d1b03422120e6042d1098896cb.png) * 输入名称并保存 +* ~~如果实在不会配置,也可以将`模组设置 > 绑定模式 > 旧绑定模式`打开 +
注意:该设置仅限原版~~ #### Tips * 可以更改配置的优先级,优先级越高的配置,在右侧排序越靠上 +* 在模组设置中,你可以通过修改配置索引来主动切换允许的配置,也可以调整到非0的数来锁定配置 +* 当开启主功能时,将鼠标放到配置上方,其中有注释`当前配置`的即为此时使用的配置 * 在`预览`界面可以更改禁用深度来禁用眼前的模型的渲染 -* 关于`禁用`界面(当前版本尚不完善,操作较为繁琐): - * 在左侧材质id输入框为空时,可以使用Alt+左键选择材质 - * 被蓝框包含的部分不会被渲染。 - * 在左侧材质视图中鼠标左键框选,其它键取消选择 - * Alt+左键可快速选中被鼠标指针指向的部分 - * `全部`模式下,整个材质所对应的模型都不会被渲染(左侧会有一个包含整个材质的蓝框来表示这一点) +* 关于`禁用`界面: + * 在左侧材质id输入框为空时,使用「Alt+左键」选择材质 + * 选择模式: + * 单选、多选:按下「Alt+左键」以选择需要禁用的面 + * 范围:按下「Alt+左键」以确定被选择区域,使用「Alt+滚轮」以更改被选择区域的大小 + * 在玩家渲染左侧材质视图中: + * 按下「鼠标左键」开始/结束框选,其它键取消选择 + * 被框选中的面效果与多选禁用的面效果相同 + * 值得一提的是,使用这种方式被禁用面,通常比使用其他方法更加节省性能 + * 禁用模式: + * `部分`模式下,被选择的面不会渲染(可以通过关闭右侧禁用配置的可见性来预览) + * `全部`模式下,整个材质所对应的模型都不会渲染(会有一个包含整个材质的蓝框来表示这一点) * ![gui_disable](https://cdn.modrinth.com/data/fYYSAh4R/images/b49ac4da6bf8a59f13c7e93ca1ef76b73e5d23b4.png) ## 依赖项目 @@ -55,10 +65,11 @@ * 为什么打不开配置界面(模组设置)? * 没有安装[Cloth Config API](https://modrinth.com/mod/cloth-config) * 为什么ysm模型有时候会弹出绑定失败? - * 快照0.6.15“尝试”修复了ysm问题,但没有修复透彻 - * 如果Minecraft版本为1.20.1,那么需要将向上矢量绑定在头部的左面(或右面),并在预览界面中将翻滚角设置为90度(或-90度) -* 为什么配置ysm时候,模型视图界面中ysm模型头部消失? - * 安装了Better Combat模组,去掉就可以了 + * 快照0.6.15“尝试”修复了ysm问题,但没有完全修复透彻 + * 当你的模型旋转到特定角时,由于ysm的`面剔除功能`,你绑定的位置可能消失,导致绑定失败 + * 可以通过增加`绑定结果保留帧数`来缓解这个问题 +* 为什么装了Better Combat模组后,禁用的材质在挥舞武器时会重新出现? + * 前往该模组的设置界面,把First person player animation 的Auto 改为False ### 兼容性 diff --git a/common/src/main/java/com/xtracr/realcamera/KeyMappings.java b/common/src/main/java/com/xtracr/realcamera/KeyMappings.java index a14d2a76..3a022cc6 100644 --- a/common/src/main/java/com/xtracr/realcamera/KeyMappings.java +++ b/common/src/main/java/com/xtracr/realcamera/KeyMappings.java @@ -25,12 +25,12 @@ public final class KeyMappings { }); createKeyMapping("toggleAdjustMode", client -> ConfigFile.config().cycleAdjustMode()); createKeyMapping("toggleCameraMode", client -> ConfigFile.config().isClassic = !ConfigFile.config().isClassic); - createKeyMapping("adjustFRONT", client -> ConfigFile.config().adjustOffsetX(1)); - createKeyMapping("adjustBACK", client -> ConfigFile.config().adjustOffsetX(-1)); createKeyMapping("adjustUP", client -> ConfigFile.config().adjustOffsetY(1)); createKeyMapping("adjustDOWN", client -> ConfigFile.config().adjustOffsetY(-1)); createKeyMapping("adjustLEFT", client -> ConfigFile.config().adjustOffsetZ(1)); createKeyMapping("adjustRIGHT", client -> ConfigFile.config().adjustOffsetZ(-1)); + createKeyMapping("adjustFRONT", client -> ConfigFile.config().adjustOffsetX(1)); + createKeyMapping("adjustBACK", client -> ConfigFile.config().adjustOffsetX(-1)); createKeyMapping("activeConfigIndexNEXT", client -> ConfigFile.config().binding.activeConfigIndex += 1); createKeyMapping("activeConfigIndexPREV", client -> ConfigFile.config().binding.activeConfigIndex -= 1); createKeyMapping("activeConfigIndexRESET", client -> ConfigFile.config().binding.activeConfigIndex = 0); diff --git a/common/src/main/java/com/xtracr/realcamera/compat/CompatibilityHelper.java b/common/src/main/java/com/xtracr/realcamera/compat/CompatibilityHelper.java index 2764aaed..c1bc4d5c 100644 --- a/common/src/main/java/com/xtracr/realcamera/compat/CompatibilityHelper.java +++ b/common/src/main/java/com/xtracr/realcamera/compat/CompatibilityHelper.java @@ -6,8 +6,10 @@ import java.lang.reflect.Field; import java.lang.reflect.Method; +import java.util.function.Function; public final class CompatibilityHelper { + public static boolean isRenderInScreen; private static PlatformHelper platformHelper; private static Method NEA_playerTransformer_setDeltaTick; private static Field NEA_NEAnimationsLoader_INSTANCE; @@ -50,6 +52,18 @@ public static void initialize(PlatformHelper platformHelper) { } catch (Exception e) { RealCamera.LOGGER.warn("Compatibility with SuperbWarfare is outdated: [{}] {}", e.getClass().getName(), e.getMessage()); } + if (isModLoaded("entity_model_features")) try { + Class EMF_EMFAnimationApi = Class.forName("traben.entity_model_features.EMFAnimationApi"); + if ((int) EMF_EMFAnimationApi.getMethod("getApiVersion").invoke(null) >= 9) { + Function function = ignored -> isRenderInScreen; + Method EMF_registerPauseCondition = EMF_EMFAnimationApi.getMethod("registerPauseCondition", Function.class); + EMF_registerPauseCondition.invoke(null, function); + } else { + throw new IllegalStateException("EntityModelFeatures API is outdated, players‘s heads in the modelView may flicker"); + } + } catch (Exception e) { + RealCamera.LOGGER.warn("Compatibility with EntityModelFeatures is outdated: [{}] {}", e.getClass().getName(), e.getMessage()); + } } private static boolean SBW_gunsIsZooming() { diff --git a/common/src/main/java/com/xtracr/realcamera/compat/DisableHelper.java b/common/src/main/java/com/xtracr/realcamera/compat/DisableHelper.java index 8d796c5f..39170ba8 100644 --- a/common/src/main/java/com/xtracr/realcamera/compat/DisableHelper.java +++ b/common/src/main/java/com/xtracr/realcamera/compat/DisableHelper.java @@ -28,9 +28,9 @@ public final class DisableHelper { RENDER_HANDS = new Entry("renderHands", player -> RealCameraCore.isRendering()); MAIN_FEATURE.registerOrInBinding(player -> ConfigFile.config().binding.disableWhenSneaking && player.isCrouching()); MAIN_FEATURE.registerOrInClassic(player -> ConfigFile.config().classic.disableWhenSneaking && player.isCrouching()); - MAIN_FEATURE.registerOrInBinding(player -> ConfigFile.config().binding.disableWhenSwimming && checkCondition(player, player.isSwimming(), ConfigFile.config().binding.outTick)); - MAIN_FEATURE.registerOrInClassic(player -> ConfigFile.config().classic.disableWhenSwimming && checkCondition(player, player.isSwimming(), ConfigFile.config().classic.outTick)); - MAIN_FEATURE.registerOrInBinding(player -> ConfigFile.config().binding.disableWhenCrawling && checkCondition(player, player.isVisuallyCrawling(), ConfigFile.config().binding.outTick)); + MAIN_FEATURE.registerOrInBinding(player -> ConfigFile.config().binding.disableWhenSwimming && checkCondition(player, player.isVisuallySwimming(), ConfigFile.config().binding.exitTick)); + MAIN_FEATURE.registerOrInClassic(player -> ConfigFile.config().classic.disableWhenSwimming && checkCondition(player, player.isVisuallySwimming(), ConfigFile.config().classic.exitTick)); + MAIN_FEATURE.registerOrInBinding(player -> ConfigFile.config().binding.disableWhenFlying && player.isFallFlying()); MAIN_FEATURE.registerOrInBinding(player -> { Item mainHand = player.getMainHandItem().getItem(); Item offHand = player.getOffhandItem().getItem(); diff --git a/common/src/main/java/com/xtracr/realcamera/config/ConfigScreen.java b/common/src/main/java/com/xtracr/realcamera/config/ConfigScreen.java index 77c91e68..a0ed7953 100644 --- a/common/src/main/java/com/xtracr/realcamera/config/ConfigScreen.java +++ b/common/src/main/java/com/xtracr/realcamera/config/ConfigScreen.java @@ -60,12 +60,12 @@ public static Screen create(Screen parent) { .setDefaultValue(false) .setSaveConsumer(b -> config.classic.disableWhenSwimming = b) .build()); - classic.addEntry(entryBuilder.startIntField(LocUtil.CONFIG_OPTION("outTick"), config.classic.outTick) + classic.addEntry(entryBuilder.startIntField(LocUtil.CONFIG_OPTION("exitTick"), config.classic.exitTick) .setDefaultValue(13) .setMin(0) .setMax(40) - .setTooltip(LocUtil.CONFIG_TOOLTIP("outTick")) - .setSaveConsumer(i -> config.classic.outTick = i) + .setTooltip(LocUtil.CONFIG_TOOLTIP("exitTick")) + .setSaveConsumer(i -> config.classic.exitTick = i) .build()); classic.addEntry(entryBuilder.startDoubleField(LocUtil.CONFIG_OPTION("scale"), config.classic.scale) .setDefaultValue(8.0) @@ -196,20 +196,20 @@ public static Screen create(Screen parent) { .setDefaultValue(false) .setSaveConsumer(b -> config.binding.disableWhenSneaking = b) .build()); - disableConfig.add(entryBuilder.startBooleanToggle(LocUtil.CONFIG_OPTION("disableWhenCrawling"), config.binding.disableWhenCrawling) - .setDefaultValue(false) - .setSaveConsumer(b -> config.binding.disableWhenCrawling = b) - .build()); disableConfig.add(entryBuilder.startBooleanToggle(LocUtil.CONFIG_OPTION("disableWhenSwimming"), config.binding.disableWhenSwimming) .setDefaultValue(false) .setSaveConsumer(b -> config.binding.disableWhenSwimming = b) .build()); - disableConfig.add(entryBuilder.startIntField(LocUtil.CONFIG_OPTION("outTick"), config.binding.outTick) + disableConfig.add(entryBuilder.startBooleanToggle(LocUtil.CONFIG_OPTION("disableWhenFlying"), config.binding.disableWhenFlying) + .setDefaultValue(false) + .setSaveConsumer(b -> config.binding.disableWhenFlying = b) + .build()); + disableConfig.add(entryBuilder.startIntField(LocUtil.CONFIG_OPTION("exitTick"), config.binding.exitTick) .setDefaultValue(13) .setMin(0) .setMax(40) - .setTooltip(LocUtil.CONFIG_TOOLTIP("outTick")) - .setSaveConsumer(i -> config.binding.outTick = i) + .setTooltip(LocUtil.CONFIG_TOOLTIP("exitTick")) + .setSaveConsumer(i -> config.binding.exitTick = i) .build()); disableConfig.add(entryBuilder.startStrList(LocUtil.CONFIG_OPTION("disableMainFeatureItems"), config.binding.disableMainFeatureItems) .setDefaultValue(List.of()) diff --git a/common/src/main/java/com/xtracr/realcamera/config/ModConfig.java b/common/src/main/java/com/xtracr/realcamera/config/ModConfig.java index 4fea0a8f..87e9abdd 100644 --- a/common/src/main/java/com/xtracr/realcamera/config/ModConfig.java +++ b/common/src/main/java/com/xtracr/realcamera/config/ModConfig.java @@ -143,7 +143,7 @@ public static class Classic { public AdjustMode adjustMode = AdjustMode.CAMERA; public boolean disableWhenSneaking = false; public boolean disableWhenSwimming = false; - public int outTick = 13; + public int exitTick = 13; public double scale = 8.0; public double cameraX = -0.5; public double cameraY = 0.04; @@ -157,7 +157,7 @@ public static class Classic { private void clamp() { if (adjustMode == null) adjustMode = AdjustMode.CAMERA; - outTick = Mth.clamp(outTick, 0, 40); + exitTick = Mth.clamp(exitTick, 0, 40); scale = Mth.clamp(scale, 0.0, 64.0); cameraX = Mth.clamp(cameraX, MIN_OFFSET_D, MAX_OFFSET_D); cameraY = Mth.clamp(cameraY, MIN_OFFSET_D, MAX_OFFSET_D); @@ -188,10 +188,10 @@ public static class Binding { public boolean adjustOffset = true; public boolean hideFailureMessage = false; public boolean renderStuckObjects = true; - public boolean disableWhenCrawling = false; public boolean disableWhenSneaking = false; public boolean disableWhenSwimming = false; - public int outTick = 13; + public boolean disableWhenFlying = false; + public int exitTick = 13; public int bindResultRetentionFrames = 2; public int activeConfigIndex = 0; public double displacementSmoothFactor = 0.4; @@ -207,7 +207,7 @@ private void clamp() { } catch (Exception e) { screenModifierKey = InputConstants.Type.KEYSYM.getOrCreate(InputConstants.KEY_LALT).getName(); } - outTick = Mth.clamp(outTick, 0, 40); + exitTick = Mth.clamp(exitTick, 0, 40); bindResultRetentionFrames = Math.max(bindResultRetentionFrames, 0); activeConfigIndex = Math.max(activeConfigIndex, 0); displacementSmoothFactor = Mth.clamp(displacementSmoothFactor, 0.0, 1.0); diff --git a/common/src/main/java/com/xtracr/realcamera/config/codec/ConfigCodec.java b/common/src/main/java/com/xtracr/realcamera/config/codec/ConfigCodec.java index 2238ed76..98d69967 100644 --- a/common/src/main/java/com/xtracr/realcamera/config/codec/ConfigCodec.java +++ b/common/src/main/java/com/xtracr/realcamera/config/codec/ConfigCodec.java @@ -7,23 +7,20 @@ import io.netty.handler.codec.DecoderException; import io.netty.handler.codec.EncoderException; import it.unimi.dsi.fastutil.shorts.Short2ReferenceMap; -import it.unimi.dsi.fastutil.shorts.Short2ReferenceOpenHashMap; +import it.unimi.dsi.fastutil.shorts.Short2ReferenceMaps; import net.minecraft.network.codec.StreamCodec; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.util.Base64; -import java.util.Map; import java.util.zip.Deflater; import java.util.zip.DeflaterOutputStream; import java.util.zip.InflaterInputStream; public final class ConfigCodec { static final short CURRENT_VERSION = 703; - static final StreamCodec CODEC_703 = ConfigCodec703.CODEC; - static final Short2ReferenceMap> CODECS = new Short2ReferenceOpenHashMap<>(Map.of( - CURRENT_VERSION, CODEC_703 - )); + static final Short2ReferenceMap> CODECS = + Short2ReferenceMaps.singleton(CURRENT_VERSION, ConfigCodec703.CODEC); public static BindTarget readWithVersion(ByteBuf byteBuf) throws DecoderException, IllegalArgumentException { short version = byteBuf.readShort(); @@ -34,7 +31,7 @@ public static BindTarget readWithVersion(ByteBuf byteBuf) throws DecoderExceptio public static void writeWithVersion(ByteBuf byteBuf, BindTarget bindTarget) throws EncoderException { byteBuf.writeShort(CURRENT_VERSION); - CODEC_703.encode(byteBuf, bindTarget); + CODECS.get(CURRENT_VERSION).encode(byteBuf, bindTarget); } public static DataResult fromCompressedBase64(String base64) { diff --git a/common/src/main/java/com/xtracr/realcamera/gui/ModelViewScreen.java b/common/src/main/java/com/xtracr/realcamera/gui/ModelViewScreen.java index 2febe9b7..a2ba000e 100644 --- a/common/src/main/java/com/xtracr/realcamera/gui/ModelViewScreen.java +++ b/common/src/main/java/com/xtracr/realcamera/gui/ModelViewScreen.java @@ -268,6 +268,7 @@ else if (index > 0 && index <= rectWidgets.size()) { BindTarget bindTarget = genBindTarget(); ConfigFile.config().putBindTarget(bindTarget); ConfigFile.save(); + if (toggleCategoryButton.getValue() != Category.DISABLE) loadBindTarget(bindTarget); initWidgets(page); })); rows.addChild(priorityField, smallSettings).setTooltip(createTooltip("priority")); @@ -404,6 +405,7 @@ public void renderBackground(GuiGraphics graphics, int mouseX, int mouseY, float } private List captureRotatedEntity(ModelAnalyser analyser, BindTarget target, LivingEntity entity) { + CompatibilityHelper.isRenderInScreen = true; float entityBodyYaw = entity.yBodyRot; float entityYaw = entity.getYRot(); float entityPitch = entity.getXRot(); @@ -425,6 +427,7 @@ private List captureRotatedEntity(ModelAnalyser analyser, Bind modelPose.translate(0, -entity.getBbHeight() / 2.0f, 0); return analyser.captureModel(minecraft, entity, 1.0f, modelPose, target); } finally { + CompatibilityHelper.isRenderInScreen = false; entity.yBodyRot = entityBodyYaw; entity.setYRot(entityYaw); entity.setXRot(entityPitch); @@ -665,10 +668,16 @@ private void loadBindTarget(BindTarget target) { } private BindTarget genBindTarget() { + DisableConfig currentDisableConfig = new DisableConfig(disabledNameField.getValue(), disabledIdField.getValue(), disableModeButton.getValue() == 0, rectWidgets.stream().map(UVRectangleWidget::toUVRectangle).toList()); + List newDisableConfigs = new ArrayList<>(disableConfigs); + for (int i = 0; i < newDisableConfigs.size(); i++) { + if (newDisableConfigs.get(i).name().equals(currentDisableConfig.name())) + newDisableConfigs.set(i, currentDisableConfig); + } TargetConfig targetConfig = new TargetConfig(forwardUField.getNumber(), forwardVField.getNumber(), upwardUField.getNumber(), upwardVField.getNumber(), posUField.getNumber(), posVField.getNumber()); BindConfig bindConfig = new BindConfig(bindXButton.getValue() == 0, bindYButton.getValue() == 0, bindZButton.getValue() == 0, bindRotButton.getValue() == 0); OffsetConfig offsets = new OffsetConfig(scaleField.getNumber(), offsetXPair.getNumber(), offsetYPair.getNumber(), offsetZPair.getNumber(), offsetPitchPair.getNumber(), offsetYawPair.getNumber(), offsetRollPair.getNumber()); - return new BindTarget(nameField.getValue(), textureIdField.getValue(), priorityField.getNumber(), depthField.getNumber(), targetConfig, bindConfig, offsets, new ArrayList<>(disableConfigs)); + return new BindTarget(nameField.getValue(), textureIdField.getValue(), priorityField.getNumber(), depthField.getNumber(), targetConfig, bindConfig, offsets, newDisableConfigs); } private UVRectangleWidget addRectWidget(UVRectangleWidget rectWidget) { diff --git a/common/src/main/resources/assets/realcamera/lang/en_us.json b/common/src/main/resources/assets/realcamera/lang/en_us.json index 6742f95a..50fd10fe 100644 --- a/common/src/main/resources/assets/realcamera/lang/en_us.json +++ b/common/src/main/resources/assets/realcamera/lang/en_us.json @@ -14,21 +14,20 @@ "config.option.xtracr_realcamera.classicAdjustMode": "Adjust Mode", "config.option.xtracr_realcamera.disableConfig": "Disable Config", "config.option.xtracr_realcamera.disableMainFeatureItems": "Disable main feature when holding", - "config.option.xtracr_realcamera.disableRenderItems": "Disable rendering when holding", - "config.option.xtracr_realcamera.disableWhenCrawling": "Disable main feature when crawling", + "config.option.xtracr_realcamera.disableRenderItems": "Disable body rendering when holding", "config.option.xtracr_realcamera.disableWhenSneaking": "Disable main feature when sneaking", - "config.option.xtracr_realcamera.disableWhenSwimming": "Disable main feature when swimming", + "config.option.xtracr_realcamera.disableWhenSwimming": "Disable main feature when swimming(crawling)", + "config.option.xtracr_realcamera.disableWhenFlying": "Disable main feature when flying", "config.option.xtracr_realcamera.displacementSmoothFactor": "Displacement Smooth Factor", "config.option.xtracr_realcamera.dynamicCrosshair": "Dynamic Crosshair", "config.option.xtracr_realcamera.enabled": "Mod Enabled", "config.option.xtracr_realcamera.hideBindingFailureMessage": "Hide Binding Failure Message", "config.option.xtracr_realcamera.isClassic": "Classic Mode", "config.option.xtracr_realcamera.legacyBindingMode": "Legacy Binding Mode", - "config.option.xtracr_realcamera.outTick": "Restriction exit delay (in ticks)", + "config.option.xtracr_realcamera.exitTick": "Restriction exit delay (in ticks)", "config.option.xtracr_realcamera.pitch": "Pitch", "config.option.xtracr_realcamera.renderModel": "Render Player Model", "config.option.xtracr_realcamera.renderStuckObjects": "Render Stuck Objects", - "config.option.xtracr_realcamera.rerenderModel": "Rerender Model", "config.option.xtracr_realcamera.roll": "Roll", "config.option.xtracr_realcamera.rotationSmoothFactor": "Rotation Smooth Factor", "config.option.xtracr_realcamera.scale": "Scale", @@ -50,10 +49,9 @@ "config.tooltip.xtracr_realcamera.dynamicCrosshair": "When enabled, the crosshair will follow the player's view, ensuring consistent hit result\nRecommended to enable when Jade, WTHIT or similar mods are installed", "config.tooltip.xtracr_realcamera.isClassic": "Classic mode only makes simple changes to the position and rotation of camera", "config.tooltip.xtracr_realcamera.legacyBindingMode": "Using the binding mode of legacy version (v0.5), only vanilla model and actions based on vanilla model are supported\nIts properties can be set in 'LEGACY_MODE' of the %s screen when enabled", - "config.tooltip.xtracr_realcamera.outTick": "The time before re-enabling main feature after exiting restricted states (e.g., swimming, crawling) (1 tick = 0.05s)", + "config.tooltip.xtracr_realcamera.exitTick": "The time before re-enabling main feature after exiting restricted states (e.g., swimming, crawling) (1 tick = 0.05s)", "config.tooltip.xtracr_realcamera.renderModel": "Render player model in first-person perspective", "config.tooltip.xtracr_realcamera.renderStuckObjects": "Arrows, bee stings and other objects that can be stuck in the player's body", - "config.tooltip.xtracr_realcamera.rerenderModel": "Render the model again at the original rendering time to avoid some visual problems caused by rendering early", "config.tooltip.xtracr_realcamera.rotationSmoothFactor": "Smooth factor of camera rotation, the higher the value, the smoother the movement", "config.tooltip.xtracr_realcamera.scale": "Control the size of the offsets", "general.xtracr_realcamera.modName": "Real Camera", @@ -61,12 +59,12 @@ "key.xtracr_realcamera.activeConfigIndexNEXT": "Switch to next configuration", "key.xtracr_realcamera.activeConfigIndexPREV": "Switch to previous configuration", "key.xtracr_realcamera.activeConfigIndexRESET": "Reset configuration index", - "key.xtracr_realcamera.adjustBACK": "Adjust BACK", - "key.xtracr_realcamera.adjustDOWN": "Adjust DOWN", - "key.xtracr_realcamera.adjustFRONT": "Adjust FRONT", - "key.xtracr_realcamera.adjustLEFT": "Adjust LEFT", - "key.xtracr_realcamera.adjustRIGHT": "Adjust RIGHT", - "key.xtracr_realcamera.adjustUP": "Adjust UP", + "key.xtracr_realcamera.adjustUP": "Adjust UP (Rotate Up)", + "key.xtracr_realcamera.adjustDOWN": "Adjust DOWN (Rotate Down)", + "key.xtracr_realcamera.adjustLEFT": "Adjust LEFT (Rotate Left)", + "key.xtracr_realcamera.adjustRIGHT": "Adjust RIGHT (Rotate Right)", + "key.xtracr_realcamera.adjustFRONT": "Adjust FRONT (Roll Right)", + "key.xtracr_realcamera.adjustBACK": "Adjust BACK (Roll Left)", "key.xtracr_realcamera.modelViewScreen": "Open Model View Screen", "key.xtracr_realcamera.toggleAdjustMode": "Toggle Adjust Mode", "key.xtracr_realcamera.toggleCameraMode": "Toggle Camera Mode", diff --git a/common/src/main/resources/assets/realcamera/lang/zh_cn.json b/common/src/main/resources/assets/realcamera/lang/zh_cn.json index 61b86c8a..b5f22c3d 100644 --- a/common/src/main/resources/assets/realcamera/lang/zh_cn.json +++ b/common/src/main/resources/assets/realcamera/lang/zh_cn.json @@ -14,21 +14,20 @@ "config.option.xtracr_realcamera.classicAdjustMode": "调整模式", "config.option.xtracr_realcamera.disableConfig": "禁用配置", "config.option.xtracr_realcamera.disableMainFeatureItems": "在手持...时禁用主要功能", - "config.option.xtracr_realcamera.disableRenderItems": "在手持...时禁用渲染", - "config.option.xtracr_realcamera.disableWhenCrawling": "爬行时禁用主要功能", + "config.option.xtracr_realcamera.disableRenderItems": "在手持...时禁用身体渲染", "config.option.xtracr_realcamera.disableWhenSneaking": "潜行时禁用主要功能", - "config.option.xtracr_realcamera.disableWhenSwimming": "游泳时禁用主要功能", + "config.option.xtracr_realcamera.disableWhenSwimming": "游泳(爬行)时禁用主要功能", + "config.option.xtracr_realcamera.disableWhenFlying": "飞行时禁用主要功能", "config.option.xtracr_realcamera.displacementSmoothFactor": "位移平滑系数", "config.option.xtracr_realcamera.dynamicCrosshair": "动态十字准心", "config.option.xtracr_realcamera.enabled": "开启功能", "config.option.xtracr_realcamera.hideBindingFailureMessage": "隐藏绑定失败消息", "config.option.xtracr_realcamera.isClassic": "经典模式", "config.option.xtracr_realcamera.legacyBindingMode": "旧绑定模式", - "config.option.xtracr_realcamera.outTick": "禁用状态退出延迟(单位:tick)", + "config.option.xtracr_realcamera.exitTick": "禁用状态退出延迟(单位:tick)", "config.option.xtracr_realcamera.pitch": "俯仰角", "config.option.xtracr_realcamera.renderModel": "渲染玩家模型", "config.option.xtracr_realcamera.renderStuckObjects": "渲染卡在身上的物体", - "config.option.xtracr_realcamera.rerenderModel": "重新渲染模型", "config.option.xtracr_realcamera.roll": "翻滚角", "config.option.xtracr_realcamera.rotationSmoothFactor": "旋转平滑系数", "config.option.xtracr_realcamera.scale": "缩放比例", @@ -50,10 +49,9 @@ "config.tooltip.xtracr_realcamera.dynamicCrosshair": "在开启状态下,十字准心会随着玩家的视线移动,确保命中结果不受影响\n在安装了Jade、WTHIT或类似模组时建议启用", "config.tooltip.xtracr_realcamera.isClassic": "经典模式只对摄像头的位置和旋转做简单的修改", "config.tooltip.xtracr_realcamera.legacyBindingMode": "使用旧版本(v0.5)的绑定模式,仅支持原版模型和基于原版模型的动作\n开启后可在%s界面的'LEGACY_MODE'中设置属性", - "config.tooltip.xtracr_realcamera.outTick": "玩家停止某些状态(如游泳、爬行)后重启主要功能的时间(1 tick = 0.05s)", + "config.tooltip.xtracr_realcamera.exitTick": "玩家停止某些状态(如游泳、爬行)后重启主要功能的时间(1 tick = 0.05s)", "config.tooltip.xtracr_realcamera.renderModel": "在第一人称视角下渲染玩家模型", "config.tooltip.xtracr_realcamera.renderStuckObjects": "箭,蜂刺和其它会卡在玩家身体里的物体", - "config.tooltip.xtracr_realcamera.rerenderModel": "在原本的渲染时机重新渲染模型,以避免一些因提前渲染导致的视觉问题", "config.tooltip.xtracr_realcamera.rotationSmoothFactor": "相机旋转平滑系数,值越大越平滑", "config.tooltip.xtracr_realcamera.scale": "控制偏移量的大小", "general.xtracr_realcamera.modName": "Real Camera", @@ -61,12 +59,12 @@ "key.xtracr_realcamera.activeConfigIndexNEXT": "切换到下一个配置", "key.xtracr_realcamera.activeConfigIndexPREV": "切换到上一个配置", "key.xtracr_realcamera.activeConfigIndexRESET": "重置配置索引", - "key.xtracr_realcamera.adjustBACK": "向后调整", - "key.xtracr_realcamera.adjustDOWN": "向下调整", - "key.xtracr_realcamera.adjustFRONT": "向前调整", - "key.xtracr_realcamera.adjustLEFT": "向左调整", - "key.xtracr_realcamera.adjustRIGHT": "向右调整", - "key.xtracr_realcamera.adjustUP": "向上调整", + "key.xtracr_realcamera.adjustUP": "向上调整(向上旋转)", + "key.xtracr_realcamera.adjustDOWN": "向下调整(向下旋转)", + "key.xtracr_realcamera.adjustLEFT": "向左调整(向左旋转)", + "key.xtracr_realcamera.adjustRIGHT": "向右调整(向右旋转)", + "key.xtracr_realcamera.adjustFRONT": "向前调整(向右滚转)", + "key.xtracr_realcamera.adjustBACK": "向后调整(向左滚转)", "key.xtracr_realcamera.modelViewScreen": "打开模型视图界面", "key.xtracr_realcamera.toggleAdjustMode": "切换调整模式", "key.xtracr_realcamera.toggleCameraMode": "切换摄像头模式", diff --git a/gradle.properties b/gradle.properties index aa685149..8fdd4c92 100644 --- a/gradle.properties +++ b/gradle.properties @@ -12,7 +12,7 @@ neoforge_version=21.1.225 moddev_version=2.0.141 ## Mod Properties mod_id=realcamera -mod_version=0.7.8-beta +mod_version=0.7.9-beta mod_group_id=com.xtracr.realcamera ## Dependencies fabric_api_version=0.116.11+1.21.1 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 1a704683..7e7d24f6 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-9.5.0-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.6.0-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME