Skip to content

Feature not working "quick lookup" [Fabric 1.20.1] #788

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
MAGGen-hub opened this issue Mar 8, 2025 · 2 comments
Open

Feature not working "quick lookup" [Fabric 1.20.1] #788

MAGGen-hub opened this issue Mar 8, 2025 · 2 comments
Labels
bug Something isn't working

Comments

@MAGGen-hub
Copy link

MAGGen-hub commented Mar 8, 2025

Mod loader

Fabric

Minecraft version

1.20.1

Patchouli version

1.20.1-84.1-fabric (downloaded from modrinth)

Modloader version

fabric-api-0.92.3+1.20.1.jar

Modpack info

Loaded mods:

Botania-1.20.1-447-FABRIC.jar
fabric-api-0.92.3+1.20.1.jar
Patchouli-1.20.1-84.1-FABRIC.jar
redbits-1.16.6.jar (was removed in last test)
trinkets-3.7.2.jar

The latest.log file

log.txt

Issue description

It seems that "quick lookup" feature is not working on Fabric 1.20.1...
No UI appears, holding Ctrl (or Shift) key with mouse over item with linked_recipe dosen't open a book.
But blocks in the world can be "lookedup" by pressing "Shift+RMB" on them...

Steps to reproduce

  1. Launch game
  2. Create new world
  3. Take botania:lexicon item
  4. Duplicate it and place it in slots: hotbar, offhand, first left inventory slot
  5. Get any item from Botania mod with linked_recipe propety in Lexicon set to true
  6. Hover mouse over it in inventory GUI.
  7. Hold activation key (Ctrl or Shift) for 10+ seconds...
  8. No UI and "quick lookup" feature =(

Other information

System: ArchLinux 6.13.5-arch1-1
Desctop: Wayland (Also tested with X11)
Desctop Environment: labwc+xfce4
Java: java-17-openjdk (Feature is working on forge 1.16.5 with same java version)

All packages is up to date and working smoothly...

@MAGGen-hub MAGGen-hub added the bug Something isn't working label Mar 8, 2025
@MAGGen-hub
Copy link
Author

Working on fix. Current solution: replace MixinGuiGraphics with MixinAbstractContainerScreen.
Sad, bud guess public void renderTooltip(Font font, ItemStack itemStack, int i, int j) is deprecated and unused now.
I set a breakpoint on it - and register no calls at all...
Current method is:
public void renderTooltip(Font font, List<Component> list, Optional<TooltipComponent> optional, int i, int j)

MixinAbstractContainerScreen turns itemStack into list of text Components used to display tooltip...
And yes, Components has no ref to itemStack so it can't be accessed from them =(

My current solution.

package vazkii.patchouli.mixin.client;

import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
import net.minecraft.world.item.ItemStack;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import net.minecraft.world.inventory.Slot;
import vazkii.patchouli.client.handler.TooltipHandler;

@Mixin(AbstractContainerScreen.class)
public class MixinAbstractContainerScreen{
    @Shadow
    Slot hoveredSlot;
    @Inject(at = @At("HEAD"), method = "renderTooltip(Lnet/minecraft/client/gui/GuiGraphics;II)V")
    public void patchouli_onRenderTooltip(GuiGraphics guiGraphics,  int x, int y, CallbackInfo info) {
        if (((AbstractContainerScreen) (Object) this).getMenu().getCarried().isEmpty() && hoveredSlot != null && hoveredSlot.hasItem()) {
            ItemStack itemStack = this.hoveredSlot.getItem();
            TooltipHandler.onTooltip(guiGraphics, itemStack, x, y);
        }
    }
}

Requires a few more tests, because all items are rendered over half-transparent half-black background of patchouli "quick lookup" tooltip.

But, thanks god, it usable already...

@MAGGen-hub
Copy link
Author

Patched version with fixed "quick lookup" and new render method of "lookup" UI:
Patchouli-1.20.1-84.1-FABRIC-SNAPSHOT.jar.zip
Working on pull requiest... (and trying to test new render method on forge)

MAGGen-hub added a commit to MAGGen-hub/Patchouli that referenced this issue Mar 8, 2025
MixinGuiGraphics used to provide "quick lookup" feature was bind to `public void renderTooltip(Font font, ItemStack itemStack, int i, int j)` method of `GuiGraphics.class` that was not working for unknown reason.
Current mixin bind to `protected void renderTooltip(GuiGraphics guiGraphics, int i, int j)` method in `AbstractContainerScreen.class`.
Rellated issue: VazkiiMods#788
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

1 participant