Skip to content

Conversation

@SidOfThe7Cs
Copy link
Contributor

@SidOfThe7Cs SidOfThe7Cs commented Feb 9, 2026

What

Cast to the base mc class the required method is in so there arnt mapping issues
screen null check is because it seems to still return true if you esc out of the screen while the search bar is focused

Changelog Fixes

  • Fixed gui editor opening while typing in rei search box. - SidOfThe7Cs

searchBar?.isFocused == true
} catch (e: NoSuchMethodError) {
try {
searchBar?.javaClass?.getMethod("method_25370")?.invoke(searchBar) as Boolean? == true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could this be an accesswidener or accessor?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how would i know

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i dont believe you can aw other mods

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the actual method call is from net.minecraft.client.gui.components.events.GuiEventListener but idk if that matters

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

method_25370 looks an awful lot like an intermediary mapping, which can be awed

Copy link
Owner

@hannibal002 hannibal002 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a workaround for a problem that needs to be properly understood first.

Why does isFocused throw NoSuchMethodError in the first place?
That is the actual root cause, which has not been investigated. This underlying issue should be investigated before adding a workaround.

A cleaner approach might be to cast to GuiEventListener instead of using reflection:

(searchBar as? GuiEventListener)?.isFocused == true

Have you tested something like this already?

@SidOfThe7Cs
Copy link
Contributor Author

that does seem to just work not sure how i forgot to try that first lol
but for my own understanding, this happenes because rei is compiled with yarn mappings and so at compile it inherits the obfuscated method names? but when we cast to the base mc class it uses the local version in official mojang mappings?

@hannibal002
Copy link
Owner

TextField.isFocused() is from REI, not Minecraft code. So as long as they don't obfuscate the code like cheats do, this is not related to many mappings, neither moaning nor yarn. The function is just in their raw plain name during runtime.

3 similar comments
@hannibal002
Copy link
Owner

TextField.isFocused() is from REI, not Minecraft code. So as long as they don't obfuscate the code like cheats do, this is not related to many mappings, neither moaning nor yarn. The function is just in their raw plain name during runtime.

@hannibal002
Copy link
Owner

TextField.isFocused() is from REI, not Minecraft code. So as long as they don't obfuscate the code like cheats do, this is not related to many mappings, neither moaning nor yarn. The function is just in their raw plain name during runtime.

@hannibal002
Copy link
Owner

TextField.isFocused() is from REI, not Minecraft code. So as long as they don't obfuscate the code like cheats do, this is not related to many mappings, neither moaning nor yarn. The function is just in their raw plain name during runtime.

@hannibal002
Copy link
Owner

that does seem to just work not sure how i forgot to try that first lol
but for my own understanding, this happenes because rei is compiled with yarn mappings and so at compile it inherits the obfuscated method names? but when we cast to the base mc class it uses the local version in official mojang mappings?

TextField.isFocused() is from REI, not Minecraft code. So as long as they don't obfuscate the code like cheats do, this is not related to many mappings, neither moaning nor yarn. The function is just in their raw plain name during runtime.

1 similar comment
@hannibal002
Copy link
Owner

that does seem to just work not sure how i forgot to try that first lol
but for my own understanding, this happenes because rei is compiled with yarn mappings and so at compile it inherits the obfuscated method names? but when we cast to the base mc class it uses the local version in official mojang mappings?

TextField.isFocused() is from REI, not Minecraft code. So as long as they don't obfuscate the code like cheats do, this is not related to many mappings, neither moaning nor yarn. The function is just in their raw plain name during runtime.

@hannibal002
Copy link
Owner

Who said using GitHub for Android is a good idea? I'm not gonna delete the other messages now our of spite. Sorry.

@ThatGravyBoat
Copy link
Contributor

that does seem to just work not sure how i forgot to try that first lol
but for my own understanding, this happenes because rei is compiled with yarn mappings and so at compile it inherits the obfuscated method names? but when we cast to the base mc class it uses the local version in official mojang mappings?

TextField.isFocused() is from REI, not Minecraft code. So as long as they don't obfuscate the code like cheats do, this is not related to many mappings, neither moaning nor yarn. The function is just in their raw plain name during runtime.

This is not the case due to how loom handles reobfuscation of mc code, and due to REI implementing TextField on a widget that also implements GuiEventListener it automatically in built reobufscated jars changes it from isFocused in TextField to the GuiEventListener method name of method_25370. Attached a screenshot of TextField decompiled from the latest fabric jar for REI
image

@SidOfThe7Cs
Copy link
Contributor Author

yea what he said
println(REIRuntime.getInstance().searchTextField?.javaClass?.simpleName)
prints -> OverlaySearchField
which both implements rei's TextField and extends minecrafts ContainerEventHandler

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants