Skip to content

Blockhaven: Java's player model, real skins, armor layers and a live inventory preview - #68

Merged
eklonofficial merged 2 commits into
eklonofficial:mainfrom
k1519035:blockhaven-player-model
Oct 3, 2026
Merged

eklonofficial merged 2 commits into
eklonofficial:mainfrom
k1519035:blockhaven-player-model

Conversation

@k1519035

@k1519035 k1519035 commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

The player now uses Java 1.20.1's own player model, poses and armor layers, so real Minecraft skins and armor textures look exactly as they do in Java, in third person, in first person and in the inventory.

Player model (js/entity/humanoid.js, new)

  • Geometry and texture layout: PlayerModel's exact geometry and texture offsets on a 64×64 skin.
    • Includes the outer layer (hat, jacket, sleeves, trousers), inflated as in Java.
    • Includes slim (Alex) 3-px arms.
  • Exact unwrap: a java model flag makes the renderer unwrap boxes exactly as ModelPart.Cube does.
    • The old unwrap put each side face's texture strip on the opposite side and flipped the bottom face. That's fine for procedural textures but wrong for real skins.
    • Java's mirrored boxes are included (positions flipped, each corner keeping its UV).
  • Poses: a port of HumanoidModel.setupAnim and PlayerModel:
    • walk swing, idle arm bob, and the attack swing that turns the body
    • crouch (torso tips forward from the neck, head lowered, legs back)
    • riding, bow, crossbow charge and hold, shield block, trident, spyglass and brush arm poses
    • two-handed ordering, elytra limb damping, and the swim/crawl stroke
  • Default skins: the four default skins are painted into this layout, so a real skin simply takes their place.
  • First-person hand: now draws the arm and sleeve from the same model.

Your own skin

  • Choosing it: Multiplayer › Skin › Load Your Skin... takes any Minecraft skin PNG, either 64×64 or a classic 64×32.
  • Processing: HttpTexture.processLegacySkin is ported. Classic skins get their left limbs copied from the right ones (mirrored), the first layer is made opaque, and Notch's hat-transparency rule applies.
  • Arms: a Classic/Slim toggle.
  • Storage: the skin is kept in this browser's settings.
  • Multiplayer: other players still see your selected default skin. Sending custom skins over the network is left for later.

Armor (HumanoidArmorModel, HumanoidArmorLayer)

  • Layers: two layers per material on Java's armor model.
    • Layer 1 (helmet, chestplate, boots) sits 1 px out.
    • Layer 2 (leggings) sits 0.5 px out.
    • Left limbs are mirrored.
    • Each piece shows only its own parts.
  • Poses: armor copies the body's pose and pivots, for players and for mobs (skeletons now wear the standard armor mesh, as in Java).
  • Resource packs: a pack's textures/models/armor/<material>_layer_1|2.png replaces the painted layers. Leather is tinted with Java's default leather colour and its _overlay is laid on top.
  • Painted defaults: without a pack, the layers are painted in the vanilla 64×32 layout, clear wherever the real textures are clear.

Inventory preview

  • Live model: the survival inventory and the creative inventory tab show the live 3D player instead of a flat picture. It includes armor, held items, pose and skin.
  • Placement: Java's positions and scales (feet at (51, 75) at 30 GUI px a block; creative at (88, 45), 20).
  • Follows the pointer: as renderEntityInInventoryFollowsMouse, the body turns up to 20° and the head up to 40° toward the pointer, tilting as it rises or falls.
  • Rendering: a small offscreen pass in the renderer, read back into the box's canvas.

Fixes

  • Elytra wind sound: it lived inside drawWeather, where the player wasn't defined. It threw every frame while raining and never ran in clear weather. It now runs every frame.
  • Packed build: this branch's minified worker also contains $&, which the packed build mangled, so the world never loaded. The same one-line tools/build.mjs fix as Blockhaven: block models in Java's element format, so pack textures map like Java #67 is included, so either PR can merge first.

Testing

  • tests/humanoid.test.mjs (new) checks:
    • The head unwraps to Java's rectangles on each side, and the face reads left to right.
    • PlayerModel texture offsets and inflation, slim arms, and arm placement.
    • Armor inflation, mirroring and parts per piece.
    • Mirrored boxes.
    • Crouch, walk and attack poses.
    • Legacy skin conversion and the opaque first layer.
  • node --test: 122 pass.
  • By eye (headless Edge):
    • With the official 1.20.1 Steve and Alex skins and iron, gold, diamond and leather armor textures (local only, not committed): front and back, slim arms, a converted 64×32 skin, crouch, walk/attack and bow poses, and leather tint and overlay.
    • In the game: the inventory preview following the pointer, with and without armor; a custom slim skin in the inventory, in third person and in the first-person hand; armor in third person; and the skin picker.
  • Browser check: the local Playwright browser check stalls at 0% world loading on this machine for upstream main as well (it passed here earlier today), so I'm relying on CI for it.

🤖 Generated with Claude Code

https://claude.ai/code/session_01R5yMmGQVzFD1XVDyZe42KG

Copilot AI balanced review requested due to automatic review settings October 2, 2026 22:38
@vercel

vercel Bot commented Oct 2, 2026

Copy link
Copy Markdown

@k1519035 is attempting to deploy a commit to the Marin Team on Vercel.

A member of the Team first needs to authorize it.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

k1519035 and others added 2 commits October 3, 2026 09:14
…inventory preview

The player is Java's PlayerModel (64x64 skin with its outer layer, slim arms) unwrapped
exactly as ModelPart.Cube, posed by a port of HumanoidModel.setupAnim. Players can load
their own Minecraft skin (64x64 or classic 64x32). Armor is Java's two-layer armor model,
using a pack's textures/models/armor when present. The inventory shows the live model
turned towards the pointer. Also fixes the elytra wind code throwing in the rain.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01R5yMmGQVzFD1XVDyZe42KG
Its angles came out NaN until the first mouse move, so the preview stayed empty.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01R5yMmGQVzFD1XVDyZe42KG
@eklonofficial
eklonofficial force-pushed the blockhaven-player-model branch from 2fbb712 to 1840256 Compare October 3, 2026 14:16
@eklonofficial
eklonofficial merged commit d538b55 into eklonofficial:main Oct 3, 2026
2 of 5 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.

3 participants