Patchouli (Fabric/Quilt)

Patchouli (Fabric/Quilt)

28M Downloads

Feature not working "quick lookup" [Fabric 1.20.1]

MAGGen-hub opened this issue ยท 2 comments

commented

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...

commented

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)

commented

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...