Skip to content

Enhance camera settings, icon management, and local library integration#4

Open
OneWorldStudio wants to merge 2 commits intoShelMarow:NeoForge-1.21.1from
OneWorldStudio:NeoForge-1.21.1
Open

Enhance camera settings, icon management, and local library integration#4
OneWorldStudio wants to merge 2 commits intoShelMarow:NeoForge-1.21.1from
OneWorldStudio:NeoForge-1.21.1

Conversation

@OneWorldStudio
Copy link
Copy Markdown

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:

  • Added a new BLOCameraSetting class to manage camera offsets, transitions, and FOV adjustments, providing smoother and more flexible camera behavior.
  • Integrated FOV adjustment via a new event handler in BetterLockOnClient, allowing dynamic changes to the field of view based on camera settings.
  • Refactored LockOnControl to 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:

  • Updated gradle.properties to disable Gradle daemon and incremented the mod version to 2.0.5-neoforge. [1] [2]
  • Rewrote the README.txt to provide detailed source installation instructions for modders, including setup steps for Eclipse and IntelliJ, mapping information, and helpful resource links.

Rendering Improvements:

  • Updated the lock-on render type in LockOnRenderTypes to use the correct mod namespace and improved the usage of render state shards for better compatibility.

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.
Copilot AI review requested due to automatic review settings April 13, 2026 13:38
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 BLOCameraSetting for smooth camera offsets + FOV adjustment, and wires FOV changes via ComputeFovModifierEvent.
  • 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.

Comment on lines +19 to +21
"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",
Copy link

Copilot AI Apr 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo in UI string: “Chance distance multiply” should be “Change distance multiplier”.

Copilot uses AI. Check for mistakes.
Comment on lines +28 to +31
"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",
Copy link

Copilot AI Apr 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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”).

Copilot uses AI. Check for mistakes.
Comment on lines +34 to +35
"screen.betterlockon.config.enable_dynamic_fov": "Enable dynamic Fov(need cam)",
"screen.betterlockon.config.max_dynamic_fov": "Max Fov multiplier"
Copy link

Copilot AI Apr 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use consistent casing for “FOV” in UI strings (currently “Fov”), since it’s a standard acronym and appears multiple times in the same section.

Copilot uses AI. Check for mistakes.
Comment on lines 10 to 12
"mixins": [
"EpicFightCameraAPIMixin"
],
Copy link

Copilot AI Apr 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copilot uses AI. Check for mistakes.
Comment on lines +355 to +359
//最远索敌距离
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);

Copy link

Copilot AI Apr 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment thread src/main/java/net/shelmarow/betterlockon/config/LockOnConfig.java
Comment thread src/main/java/net/shelmarow/betterlockon/config/LockOnConfig.java
Comment thread src/main/java/net/shelmarow/betterlockon/client/render/icon/IconTypeManager.java Outdated
Comment on lines +41 to 44
if (!hasStamina && ModList.get().isLoaded(Indestructible.MOD_ID) && livingEntityPatch instanceof IAdvancedCapability capability) {
staminaRatio = capability.getStamina() / capability.getMaxStamina();
hasStamina = true;
}
Copy link

Copilot AI Apr 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment thread src/main/java/net/shelmarow/betterlockon/client/render/icon/IconTypeManager.java Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants