Quark Oddities

Quark Oddities

22M Downloads

Chest searching with incorrect logic

Towdium opened this issue ยท 0 comments

commented

After reading source code of ChestSearchingModule.java, it seems some logic might be outdated.

It tests elements based on names generated by TranslationTextComponent.toString:

String name = stack.getDisplayName().toString();
... ...
if(matcher.test(name, search)) return true;

But the toString method actually generates a complex representation which might not be expected:

public String toString() {
      return "TranslatableComponent{key='" + this.key + '\'' + ", args=" + ... ...
}

As the result, it is making matches like "TranslatableComponent{key= ... ...".contains(search), and the names are not localized.