Skip to content

Issue 3 | Hand Scaling - #6

Merged
Flapjacck merged 3 commits into
mainfrom
issue-3
Oct 16, 2026
Merged

Flapjacck merged 3 commits into
mainfrom
issue-3

Conversation

@Flapjacck

Copy link
Copy Markdown
Owner

Summary

Implements the "Apply Hand Scale" feature requested in #3, fixes two GUI bugs
introduced during development, and corrects a crash caused by a wrong mixin
target method name.


Changes

New feature — Apply Hand Scale toggle

A new "Apply Hand Scale: ON/OFF" toggle button has been added to the settings
panel, styled identically to the existing "Ignore Haste" button.

  • When OFF (default): item scale only affects the held item model. The
    player's bare arm renders at vanilla size. This is the existing behaviour.
  • When ON: the bare-hand arm mesh also scales to match HELD_ITEM_SCALE.
    This is visible when holding nothing. When holding an item, the arm geometry
    is rendered by a separate entity-renderer pipeline that is outside the scope
    of ItemInHandRenderer; the item itself still scales correctly in all cases.

Config persistence

ItemTweaksConfig gains a new APPLY_HAND_SCALE boolean field (default
false). It is read from and written to config/swing.json alongside the
existing fields, and is reset by the Reset button.

New mixin — ItemInHandRendererArmMixin

Targets AvatarRenderer#renderRightHand and AvatarRenderer#renderLeftHand
(the only methods that render the first-person arm mesh). Applies a
push/scale/pop around each call when APPLY_HAND_SCALE is enabled.

GUI scrolling — rewritten, no longer broken

The previous scroll implementation called this.init() inside
mouseScrolled, which re-added every widget to the list on each tick without
clearing it first. This caused widgets to stack on top of each other
(visible as duplicated/overlapping controls).

The scroll system has been replaced with an in-place repositioning approach:

  • Widgets are created once in init().
  • A repositionScrollableWidgets() method calls setX()/setY() directly
    on each widget reference and sets widget.visible = false for any widget
    fully outside the clipping window.
  • mouseScrolled calls repositionScrollableWidgets() — never init().
  • scrollOffset is clamped to [0, MAX_SCROLL] using Mth.clamp.

Known limitation

"Apply Hand Scale" does not visually affect the arm while the player is holding
an item. When holding an item, the arm skin is rendered by the entity-renderer
pipeline (LivingEntityRenderer → player model layers), which is entirely
separate from ItemInHandRenderer. Scaling the arm in that context would
require injecting into the entity renderer and is out of scope for this PR.

Closes #3

@Flapjacck
Flapjacck merged commit dfb8afc into main Oct 16, 2026
2 checks passed
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.

Player Hand not Affected by Item Scale Size

1 participant