-
Notifications
You must be signed in to change notification settings - Fork 0
Hand Renderer Event
liopyu edited this page Feb 12, 2025
·
5 revisions
The handRenderer event is a client-side event that allows modification of how a player's hand and held items are rendered. This event provides various rendering-related parameters that can be used to customize the rendering behavior. Cancelling the event with event.cancel() will make it so the hand is not rendered.
AnimationJS.handRenderer(event => {
const { player, partialTicks, poseStack, combinedLight, buffer, itemInHandRenderer } = event
})The event object contains the following properties:
-
player(Player): The player whose hand is being rendered. -
partialTicks(float): The partial tick time used for smooth interpolation. -
poseStack(PoseStack): The matrix stack used for transformations. -
combinedLight(int): The light value at the render location. -
buffer(MultiBufferSource): The buffer used for rendering. -
itemInHandRenderer(ItemInHandRenderer): The renderer for the item in hand.
To modify the way the player's hand is rendered, you can transform the poseStack or override the rendering behavior:
AnimationJS.handRenderer(event => {
const { poseStack, player } = event
if (player.isCrouching()) {
// Apply a transformation to the hand when the player is crouching
poseStack.translate(0, -0.2, 0)
}
})- This event runs on the client only.
- You can use this event to modify the positioning or behavior of the player's hand during rendering.
- Avoid performance-heavy operations within this event, as it is called every frame.