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.

[1.19.4] Alternatives to ItemRenderer.renderGuiItem(), .renderAndDecorateFakeItem() and .blitOffset ?

Featured Replies

Posted

Hi all,

I think the title says it all. I was using the ItemRenderer.renderGuiItem(), .renderAndDecorateFakeItem() and .blitOffset methods/properties on my mod for 1.18.2, but whilst trying to update to 1.19.4 I realized that they were no longer available, nor could I find any suitable replacements.

If necessary, here is how I was using each method:

- .renderGuiItem() and .blitOffset were to render fake items inside a Button subclass:

//Draw item
        if(item.isItem()) {
            itemRenderer.renderGuiItem(item.getItem(), x, y);
        }

        //Highlight background and write item name if hovered or focused
        if(isHoveredOrFocused()){
            isMouseOn = true;
            fill(matrix, x, y, x+width, y+height, 0xFFFFFFDF);
        }else{
            isMouseOn = false;
        }

        //Write quantity based on buttons pressed (sneak & run)
        matrix.pushPose();
        matrix.translate(0, 0, itemRenderer.blitOffset+201);
        matrix.scale(.5f, .5f, 1);
        Font font = Minecraft.getInstance().font;
        drawString(matrix, font, getQuantity()+"", 2*(x+16)- font.width(getQuantity()+""), 2*(y)+24, 0xFFFFFF);
        if(item.isTag()){
            drawString(matrix, font, "#", 2*x+width*2-font.width("#")-1, 2*y+1, 0xFFC921);
        }else if(!item.isItem()){
            drawString(matrix, font, "F", 2*x+1, 2*y+1, 0x6666FF);
        }

- .renderAndDecorateFakeItem() was used to render a fake item inside a Screen subclass:

private void renderItem(PoseStack matrixStack, Item item, int x, int y) {
        ItemRenderer itemRenderer = this.minecraft.getItemRenderer();
        ItemStack itemStack = new ItemStack(item);
        itemRenderer.renderAndDecorateFakeItem(itemStack, x, y);
    }

Which are the alternatives for 1.19.4?

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.