Enhance camera settings, icon management, and local library integration#4
Enhance camera settings, icon management, and local library integration#4OneWorldStudio wants to merge 2 commits intoShelMarow:NeoForge-1.21.1from
Conversation
Introduce BLOCameraSetting and FOV hook (ComputeFovModifierEvent) to support camera offsets and smooth transitions; register a MovementInputUpdateEvent handler to simplify movement-based lock-on behavior via EpicFightCameraAPI. Refactor icon rendering: add IconTypeManager, move icon types into client.render.icon package, and update LockOnRenderer/LockOnRenderTypes to use new texture/shader state APIs, support optional stamina sources (EpicFight/Indestructible), and improve sizing/ rendering logic. Build and project changes: switch to local libs (libs/*.jar), reference epic fight jar, use mavenCentral(), adjust generateModMetadata quoting, and bump mod_version to 2.0.5. Add resources and compatibility stubs (access transformer, zh_cn locale, new mixins/compat classes) and update README and gradle properties.
There was a problem hiding this comment.
Pull request overview
This PR modernizes Better Lock On’s camera/lock-on behavior around EpicFight’s camera API, adds a camera-offset/FOV settings helper, refactors input handling, and restructures lock-on icon type management while updating build/config/docs.
Changes:
- Replaces previous LocalPlayerPatch-based lock-on mixins with a large EpicFightCameraAPI mixin that handles targeting, camera transforms, dynamic camera offsets, and lock-on rules.
- Introduces
BLOCameraSettingfor smooth camera offsets + FOV adjustment, and wires FOV changes viaComputeFovModifierEvent. - Refactors icon types into an extensible manager + updates render types and localization resources.
Reviewed changes
Copilot reviewed 30 out of 42 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
| src/main/templates/META-INF/neoforge.mods.toml | Updates logo path and raises required EpicFight version range. |
| src/main/resources/META-INF/accesstransformer.cfg | Adds AT entries for Camera fields/methods used by camera handling. |
| src/main/resources/betterlockon.mixins.json | Mixins config updated (required=true) and mixin list changed. |
| src/main/resources/betterlockon.compat.mixins.json | Adds refmap and expands compat mixins for shoulder-surfing/thirdperson. |
| src/main/resources/assets/betterlockon/lang/zh_cn.json | Adds Simplified Chinese UI strings for config screen. |
| src/main/resources/assets/betterlockon/lang/en_us.json | Replaces English UI strings for config screen. |
| src/main/java/net/shelmarow/betterlockon/mixins/LocalPlayerPatchMixin.java | Removes previous lock-on behavior override mixin. |
| src/main/java/net/shelmarow/betterlockon/mixins/LocalPlayerPatchAccessor.java | Removes previous accessor mixin for LocalPlayerPatch internals. |
| src/main/java/net/shelmarow/betterlockon/mixins/EpicFightCameraAPIMixin.java | New primary mixin implementing camera + targeting/lock-on logic. |
| src/main/java/net/shelmarow/betterlockon/mixins/CameraAccessor.java | Adds accessors/invokers for vanilla Camera internals. |
| src/main/java/net/shelmarow/betterlockon/config/LockOnConfig.java | Reworks config schema; adds pitch/dynamic camera/FOV controls; icon type becomes string-based. |
| src/main/java/net/shelmarow/betterlockon/compat/mixins/ThirdPersonEventsMixin.java | Cancels third-person movement impulse under lock-on for compat. |
| src/main/java/net/shelmarow/betterlockon/compat/mixins/ShoulderSurfingImplMixin.java | Shoulder Surfing behavior adjustments while locked-on. |
| src/main/java/net/shelmarow/betterlockon/compat/mixins/ShoulderSurfingCameraMixin.java | Applies dynamic camera + pitch behavior for Shoulder Surfing camera. |
| src/main/java/net/shelmarow/betterlockon/compat/mixins/EntityAgentMixin.java | Disables prior injected logic (now commented out). |
| src/main/java/net/shelmarow/betterlockon/compat/mixins/ClientEventHandlerMixin.java | Cancels Shoulder Surfing input/rotation updates while locked-on. |
| src/main/java/net/shelmarow/betterlockon/compat/mixins/CameraAgentMixin.java | Disables prior injected logic (now commented out). |
| src/main/java/net/shelmarow/betterlockon/compat/HandlerShoulderSurfingCompat.java | Helper for syncing camera rotations with Shoulder Surfing. |
| src/main/java/net/shelmarow/betterlockon/client/render/type/LockOnIconTypes.java | Removes old enum-based icon selection. |
| src/main/java/net/shelmarow/betterlockon/client/render/LockOnRenderTypes.java | Fixes render type names/namespace and shard usage. |
| src/main/java/net/shelmarow/betterlockon/client/render/LockOnRenderer.java | Updates lock-on drawing logic; integrates icon manager + stamina sources. |
| src/main/java/net/shelmarow/betterlockon/client/render/icon/type/RPGType1.java | Moves/updates RPG icon type implementation and behavior. |
| src/main/java/net/shelmarow/betterlockon/client/render/icon/type/IconType.java | Adds getName() and reverse() to icon type API. |
| src/main/java/net/shelmarow/betterlockon/client/render/icon/type/DefaultType.java | Moves default icon type and implements new IconType API. |
| src/main/java/net/shelmarow/betterlockon/client/render/icon/IconTypeManager.java | New icon type registry/lookup and “next type” helper. |
| src/main/java/net/shelmarow/betterlockon/client/control/LockOnControl.java | Refactors input handling to MovementInputUpdateEvent-based logic. |
| src/main/java/net/shelmarow/betterlockon/client/control/BLOCameraSetting.java | New camera offset + transition + FOV offset state manager. |
| src/main/java/net/shelmarow/betterlockon/BetterLockOnClient.java | Adds FOV modifier event handler tied to BLOCameraSetting. |
| README.txt | Expands modder source setup documentation. |
| gradle.properties | Disables Gradle daemon and bumps mod version. |
| build.gradle | Enables AT file, changes repos/deps to local jars, adds local libs wiring. |
| .gitignore | Removes ignores for some generated run directories. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| "screen.betterlockon.config.max_soft_angle_y": "Max soft angle Y", | ||
| "screen.betterlockon.config.change_distance_multiply": "Chance distance multiply", | ||
| "screen.betterlockon.config.change_speed_multiply": "Change speed multiply", |
There was a problem hiding this comment.
Typo in UI string: “Chance distance multiply” should be “Change distance multiplier”.
| "screen.betterlockon.config.fix_wom_lockon": "WOM Lock on fix", | ||
| "screen.betterlockon.config.white_list": "White list have not screen now, please set it in config file", | ||
| "screen.betterlockon.config.black_list": "Black list have not screen now, please set it in config file", | ||
| "screen.betterlockon.config.enable_dynamic_camera": "Enable dynamic camera", |
There was a problem hiding this comment.
The “White list…” / “Black list…” strings are ungrammatical and hard to understand in-game. Consider rephrasing to something clearer (e.g., “No screen available yet; edit the config file to set the whitelist/blacklist”).
| "screen.betterlockon.config.enable_dynamic_fov": "Enable dynamic Fov(need cam)", | ||
| "screen.betterlockon.config.max_dynamic_fov": "Max Fov multiplier" |
There was a problem hiding this comment.
Use consistent casing for “FOV” in UI strings (currently “Fov”), since it’s a standard acronym and appears multiple times in the same section.
| "mixins": [ | ||
| "EpicFightCameraAPIMixin" | ||
| ], |
There was a problem hiding this comment.
EpicFightCameraAPIMixin is in the top-level mixins list, which applies on both client and dedicated server. Since it references net.minecraft.client.* (and targets client-side EpicFight camera code), it’s likely to fail on a dedicated server. Move it to the client array (or a dedicated client-only mixin config).
| //最远索敌距离 | ||
| double entityPickRange = LockOnConfig.MAX_TARGET_SELECT_DISTANCE.get() * LockOnConfig.MAX_TARGET_SELECT_DISTANCE.get(); | ||
|
|
||
| AABB aabb = localPlayer.getBoundingBox().move(cameraPos.subtract(localPlayer.getEyePosition(1.0F))).expandTowards(lookVec.scale(entityPickRange)).inflate(1.0D, 1.0D, 1.0D); | ||
|
|
There was a problem hiding this comment.
entityPickRange is computed as a squared distance, but it’s then used as a linear distance in lookVec.scale(entityPickRange) when building the search AABB. This inflates the search region drastically (e.g., 30 -> 900 blocks) and can hurt performance and targeting correctness. Use a linear range for vector scaling and only square where required.
| if (!hasStamina && ModList.get().isLoaded(Indestructible.MOD_ID) && livingEntityPatch instanceof IAdvancedCapability capability) { | ||
| staminaRatio = capability.getStamina() / capability.getMaxStamina(); | ||
| hasStamina = true; | ||
| } |
There was a problem hiding this comment.
Indestructible.MOD_ID is referenced directly here. If the Indestructible mod is not installed, the getstatic access for that field can throw NoClassDefFoundError before ModList#isLoaded can short-circuit. Use a string literal mod id and isolate optional-mod types behind reflection / a compat layer that only loads when present.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This pull request introduces significant updates to the Better Lock On mod, focusing on camera control enhancements, input handling improvements, and general project configuration updates. The most notable changes include the addition of a new camera settings class for managing camera offsets and FOV, a major refactor of the lock-on control logic to simplify input handling, and updates to documentation and build properties.
Camera and Input Handling Improvements:
BLOCameraSettingclass to manage camera offsets, transitions, and FOV adjustments, providing smoother and more flexible camera behavior.BetterLockOnClient, allowing dynamic changes to the field of view based on camera settings.LockOnControlto remove complex mouse movement tracking and target selection logic, replacing it with a streamlined handler for movement input events. This simplifies the code and leverages the EpicFightCameraAPI for lock-on state checks.Project Configuration and Documentation:
gradle.propertiesto disable Gradle daemon and incremented the mod version to2.0.5-neoforge. [1] [2]README.txtto provide detailed source installation instructions for modders, including setup steps for Eclipse and IntelliJ, mapping information, and helpful resource links.Rendering Improvements:
LockOnRenderTypesto use the correct mod namespace and improved the usage of render state shards for better compatibility.