Applied Energistics 2

Applied Energistics 2

156M Downloads

Compat issue with CoFH Core keywords feature

andriihorpenko opened this issue ยท 5 comments

commented

Describe the bug

Description

CoFH Core utilizes a feature called "keywords", aka search aliases. Basically, when you write "tank" in JEI search, you get a list of fluid containers from CoFH mods (tanks, cells, etc).
The way they do it is by appending invisible text after item name, so a player won't see it with a naked eye, but JEI will gladly parse that and provide relevant results.

Implementation: https://github.com/CoFH/CoFHCore/blob/62908ffc3e041ed204b20f98c15334fe1d0dbbe3/src/main/java/cofh/core/event/CoreClientEvents.java#L94

It works fine in English localization, but it becomes funky with other languages exceptionally inside ME interfaces.

Reproduction

Screenshot 1: machine Insolator, translated in Russian and placed inside a player inventory. So far no issues.
image

Screenshot 2: same machine, same language, but placed inside a Pattern Encoding Terminal grid. You can notice that ME explicitly renders those invisible "keywords" afterwards, which looks not so pleasant.

image

I would agree that the implementation of the feature could be better, but it appears to only affect ME interfaces, so I would assume something might need to be changed on your end in terms of tooltip rendering.

How to reproduce the bug

  1. Install Thermal Series mods
  2. Switch in-game language to another non-English language (I used Russian in the examples above)
  3. Place Insolator inside a Pattern Encoding Terminal grid
  4. Hover over placed item

Expected behavior

Match vanilla's tooltip rendering behavior

Additional details

No response

Which minecraft version are you using?

1.19

On which mod loaders does it happen?

Forge

Crash log

https://bytebin.lucko.me/xs4HQ1hzfq

commented

Sorry, but I don't think this is important enough for 1.19 to fix back there
And yes, the CofH implementation is... very debatable

commented

Cool. Let's debate it. I correctly use a Forge event to strip away the part of the tooltip rendered in that style.

What are you doing that may prevent said event from firing?

commented

Cool. Let's debate it. I correctly use a Forge event to strip away the part of the tooltip rendered in that style.

What are you doing that may prevent said event from firing?

We do our own tooltip word-wrapping, which means GatherComponents is not fired. RenderTooltipEvents are.

commented

Okay. Could you do it correctly instead please? Or at least acknowledge that this is fundamentally a choice you have made rather than casting aspersions.

It's more than a bit disingenuous to say that my implementation is debatable when I'm doing what I am supposed to do when I am supposed to do it, as per the documentation, and then you just ignore all of that and don't fire the event.

commented

Okay. Could you do it correctly instead please? Or at least acknowledge that this is fundamentally a choice you have made rather than casting aspersions.

It's more than a bit disingenuous to say that my implementation is debatable when I'm doing what I am supposed to do when I am supposed to do it, as per the documentation, and then you just ignore all of that and don't fire the event.

We are calling standard API methods on Component.
You are returning non-printable characters (if that screenshot is to be believed) in your item names when tooltips are queried and rely on getTooltipLines only being called in that one specific sequence (edit: where you can then delete them again later).

I'll stand by: That is debatable.