VazkiiMods / Patchouli

Accessible, Data-Driven, Dependency-Free Documentation for Minecraft Modders and Pack Makers
https://vazkiimods.github.io/Patchouli/
Other
314 stars 124 forks source link

Locked recipes on unlocked entries should not have "quick lookup" #738

Open TheRealWormbo opened 7 months ago

TheRealWormbo commented 7 months ago

Mod loader

Forge

Minecraft version

1.20.1

Patchouli version

1.20.1-84-FORGE

Modloader version

Forge 47.1.3

Modpack info

(none)

The latest.log file

https://gist.github.com/TheRealWormbo/89c83343b1372f4451d5d847e53fde27

Issue description

The feature for quickly opening a book by pressing Ctrl (or Shift) while hovering the mouse over an item in an inventory screen only checks whether the entire entry containing the lookup target is locked. However, it may still be possible that the lookup target itself is locked behind an additional advancement, causing Patchouli to open an incorrect or empty page after the end of the accessible parts of the entry. This particular scenario can happen especially with recipe lookup mods like JEI, which show the items regardless of Patchouli unlocks, but allow players to use Patchouli's lookup key.

Steps to reproduce

Following example is based on recent 1.20.1 versions of Botania (with Patchouli and Curios API) and JEI:

  1. Clear all advancements.
  2. Get Lexica Botania and a mana pool (this unlocks the entry for mana rings)
  3. Open any screen with JEI and find the various mana rings in the item list.
  4. Hover over thew "Greater Ring of Mana" (Patchouli allows lookup) and hold Ctrl (or Shift, if configured that way)
  5. The Lexica Botania opens on an empty page, which turns out to be after the end of the entry for the Ring of Mana. That entry also contains a page about the Greater Ring of Mana, but it's locked behind another advancement (unlocked by obtaining a Terrasteel Ingot item)

Other information

Apparently this could even cause a crash in 1.16.5 (see https://github.com/VazkiiMods/Botania/issues/3691, probably similar to #614), which seems to have been fixed in later versions.

I would assume that the issue also exists on Fabric, but it seems like the quick lookup logic is not available there, at least with Botania.