Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

I want to make a custom first person hand model. Can anyone tell me how can I do this or give me examples of open source mods that have done this

I would look at PlayerRenderer#renderHand to see how a hand is rendered normally. Then it's just creating the java model and replacing it via RenderArmEvent and canceling it. If you also want to replace the rendering of whatever is in the hand as well, use RenderHandEvent instead.

  • Author
On 3/26/2023 at 6:07 PM, ChampionAsh5357 said:

I would look at PlayerRenderer#renderHand to see how a hand is rendered normally. Then it's just creating the java model and replacing it via RenderArmEvent and canceling it. If you also want to replace the rendering of whatever is in the hand as well, use RenderHandEvent instead.

I wrote this code and my hand model renders but doesn't follow camera rotation(https://imgur.com/1pgyxUl). I took the PoseStack installation code from GameRenderer#renderLeve.

   @OnlyIn(Dist.CLIENT)
    @SubscribeEvent()
    public static void onRenderHand(RenderArmEvent event)
    {
        if(handRenderer == null)
            handRenderer = new CustomHandRenderer();

        var minecraft = Minecraft.getInstance();
        var camera = minecraft.gameRenderer.getMainCamera();
        var poseStack = new PoseStack();

        poseStack.mulPose(Vector3f.XP.rotationDegrees(camera.getXRot()));
        poseStack.mulPose(Vector3f.YP.rotationDegrees(camera.getYRot() + 180.0F));
        applyItemArmTransform(poseStack, HumanoidArm.RIGHT, 1);

        handRenderer.render(
                null,
                poseStack,
                event.getMultiBufferSource(),
                event.getPackedLight());
        event.setCanceled(true);
    }

For rendering I use GeckoLib

Edited by Jetug

  • Author

Turns out it was much easier 

    @OnlyIn(Dist.CLIENT)
    @SubscribeEvent()
    public static void onRenderHand(RenderArmEvent event)
    {
        if(handRenderer == null)
            handRenderer = new CustomHandRenderer();

        var poseStack = new PoseStack();
        poseStack.translate(0.5, -0.5, -0.6);

        handRenderer.render(
                null,
                poseStack,
                event.getMultiBufferSource(),
                event.getPackedLight());
        event.setCanceled(true);
    }

https://i.imgur.com/tHo5mqo.png

Edited by Jetug

  • 1 year later...
On 3/30/2023 at 9:24 AM, Jetug said:

Turns out it was much easier 

    @OnlyIn(Dist.CLIENT)
    @SubscribeEvent()
    public static void onRenderHand(RenderArmEvent event)
    {
        if(handRenderer == null)
            handRenderer = new CustomHandRenderer();

        var poseStack = new PoseStack();
        poseStack.translate(0.5, -0.5, -0.6);

        handRenderer.render(
                null,
                poseStack,
                event.getMultiBufferSource(),
                event.getPackedLight());
        event.setCanceled(true);
    }

https://i.imgur.com/tHo5mqo.png

whats your "CustomHandRenderer"?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.