The-Aether-Team / The-Aether-Archived

The original "The Aether" mod, ported to the 1.7.10 and 1.12.2 versions of Minecraft. Currently unmaintained; accepting PRs.
https://www.curseforge.com/minecraft/mc-mods/the-aether
GNU Lesser General Public License v3.0
33 stars 28 forks source link

(1.7.10) Fix Aether buttons in modded GUI subclasses #145

Closed makamys closed 10 months ago

makamys commented 3 years ago

See https://github.com/gildedgames/aether-issues/issues/742.

In many places, the classes of GUI objects are directly compared with vanilla ones. These checks fail with subclasses of these classes introduced by mods, resulting in Aether's buttons not showing up in these GUIs. This happens in InfiniteInvo and Satchels, which replace GuiInventory with their own subclass. Even if these modded GUIs added the Aether button to their button lists manually, the buttons don't do anything when clicked because they fail the check in onButtonPressed(): https://github.com/Gilded-Games/The-Aether-Archived/blob/63e9a73e80a990c5ae654c925d29b0062f4c22b5/src/main/java/com/gildedgames/the_aether/client/AetherClientEvents.java#L384

Since instanceof is used to compare GUI classes in a few places in an inconsistent manner, I am led to believe that this was made in error, and the intention was to use instanceof everywhere. This PR changes all GUI class comparisons to use instanceof unless this would cause an issue.

With this change, Aether's button now shows up in the modded inventory GUIs of both of the aforementioned mods, but in the wrong position.

2021-08-31_06 16 46

To solve this, the button placement equation is changed to be consistent with how Baubles places its button. This should improve compatibility, since the Baubles button is what most mods are tested with, and can thus be considered the standard.

With this additional change, the Aether button now appears in the right position.

2021-08-31_07 58 40


I agree to the Contributor License Agreement found in CONTRIBUTING.md.