Carry Mechanics (0.0.0-beta.43)
Curse Maven Snippet
What's new
v0.0.0-beta.43 — Carried block now renders as a real held item
Fix
- Root cause of the broken block visuals: the carried block was rendered as a raw
BlockModelRenderStateviaBlockDisplayContext.create(). In this Minecraft version that class carries no held-in-hand transform at all (no scale, rotation or offset), so the previous first/third-person positioning relied on hand-pickedtranslate/rotatevalues that never matched the player's actual hand bone — hence invisible in first person and floating inside the body in third person. - First person: the carried block is now resolved and rendered as an
ItemStackof the block viaItemModelResolverwithItemDisplayContext.FIRST_PERSON_RIGHT_HAND, using the same base transform vanilla uses for a held item (ItemInHandRenderer#applyItemArmTransform). The display context already carries the correct scale/rotation, so no manual guesswork offsets are needed anymore. - Third person: same item-based approach with
ItemDisplayContext.THIRD_PERSON_RIGHT_HAND, anchored to the player model's hand bone viaPlayerModel#translateToHandplus the same small offset vanilla'sItemInHandLayer#submitArmWithItemapplies for a right-hand item — matching how every other held item is drawn, instead of a full-block-sized offset from the feet.
Technical Changes
CarriedBlockRenderer— now resolves anItemStackRenderStatefornew ItemStack(blockState.getBlock().asItem())viaItemModelResolver.updateForLiving(...)instead of aBlockModelRenderState.ICarryOnRenderState/PlayerRenderStateMixin— added a cachedItemStackRenderStateon the avatar render state, resolved once per frame duringextractRenderState(where the entity is available) and consumed duringsubmit.AvatarExtractorMixin— resolves the carried block's item render state withItemDisplayContext.THIRD_PERSON_RIGHT_HAND.CarryingItemRenderLayer— anchors to the hand bone and submits the resolvedItemStackRenderStateinstead of drawing a block model with manual offsets.ItemInHandRendererMixin— resolves and submits the item withItemDisplayContext.FIRST_PERSON_RIGHT_HAND, using vanilla's own arm-transform offset instead of hand-picked rotation/scale values.
All Relations
- All Relations
- Embedded Library
- Optional Dependency
- Required Dependency
- Tool
- Incompatible
- Include
This mod has no related projects