mojira.dev
MC-262003

Bundle tooltip does not show its interface

Steps to reproduce

  1. Create a new world with the experimental feature Bundles in Creative Mode.

  2. Open the inventory and get one bundle.

  3. Insert some items in the bundle and watch the tooltip.

It does not show the inserted items, but shows its number. This worked correctly in 23w14a.

Code analysis

A code analysis by @unknown can be found in this comment.

Linked issues

Attachments

Comments 4

(note: all class names are from yarn mappings, so keep that in mind)

 

This is a result of the new modifications to the DrawableHelper class. See the code utilized for rendering an item's tooltip:

private void method_51435(TextRenderer textRenderer, List<TooltipComponent> list, int i, int j, TooltipPositioner tooltipPositioner) {
    if (!list.isEmpty()) {
        
        //lots of boilerplate setup that is irrelevant to the bug

        for(t = 0; t < list.size(); ++t) {
            tooltipComponent2 = (TooltipComponent)list.get(t);
            tooltipComponent2.drawText(textRenderer, p, s, this.field_44657.peek().getPositionMatrix(), this.field_44658);
            s += tooltipComponent2.getHeight() + (t == 0 ? 2 : 0);
        }

        s = q;

        for(t = 0; t < list.size(); ++t) {
            tooltipComponent2 = (TooltipComponent)list.get(t);
            tooltipComponent2.drawText(textRenderer, p, s, this.field_44657.peek().getPositionMatrix(), this.field_44658);
            s += tooltipComponent2.getHeight() + (t == 0 ? 2 : 0);
        }

        this.field_44657.pop();
    }
}

Notice something off about it? It calls the exact same thing twice!

 

Now take a ponder at the interfaces available via the TooltipComponent interface.

int getHeight();

int getWidth(TextRenderer textRenderer);

default void drawText(TextRenderer textRenderer, int x, int y, Matrix4f matrix, VertexConsumerProvider.Immediate vertexConsumers) {
}

default void drawItems(TextRenderer textRenderer, int x, int y, DrawableHelper drawableHelper) {
}

Oops, looks like drawItems() was forgotten to be called 😞

Bug still exist in 23W17A.

Bug confirmed as fixed in 23W18A.

I noticed this but at least it's fixed

stargazer

gegy

Confirmed

Platform

Important

UI

23w16a, 23w17a

23w18a

Retrieved