New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Recipe tooltip fixes #402
Recipe tooltip fixes #402
Conversation
Handlers might call Minecraft#displayGuiScreen and overwrite Minecraft.currentScreen, but the height hack would unconditionally undo this again.
For posterity: this fixes an issue reported on Discord where the nei-custom-diagram handlers in tooltip widgets would only draw over the main GuiScreen area: I have pushed an additional commit to fix GTNewHorizons/GT-New-Horizons-Modpack#13954. The root cause was that a recipe handler (in this case nei-custom-diagram) might modify However, there are actually multiple possible ways to fix these issues. The purpose of the height hack originally was to make certain legacy recipe handlers compatible with the layout changes (as I understand it). Considering that enabling it required explicit opt-in through The override for private void drawLiquidTooltip(FluidStack stack, int x, int recipe) {
int y = 55;
GuiRecipe gui = (GuiRecipe)Minecraft.getMinecraft().currentScreen;
Point mouse = GuiDraw.getMousePosition();
Point offset = gui.getRecipePosition(recipe);
String tooltip = stack.getLocalizedName() + " (" + stack.amount + "mb)";
GuiTooltipHelper.drawAreaTooltip(mouse.x - (gui.width - 176) / 2 - offset.x, mouse.y - (gui.height - 176) / 2 - offset.y, tooltip, x, 55, x + 12, 102);
} The IC2 handlers are configured to have the height hack applied by default so those were fixed. However, it turns out that nei-custom-diagram also assumes a similar condition and breaks with the recipe tooltip widgets. The thing is. nei-custom-diagram is not a legacy handler, it was made with GTNH NEI in mind and didn't require the height hack previously. We could've fixed it in a number of ways:
Here is how I see it: Why not add it to The issue I see with option 3 is that it doesn't really fit with the purpose of "height hacking" (it's not meant to only apply for legacy handlers since it's unconditional). The only similarity is that it need to be applied through the same mechanism. As such I think the What do you think @eigenraven? I hope this made sense. |
Warning: 2 uncommitted changes |
Co-authored-by: GitHub GTNH Actions <>
@wlhlm I agree that this should be handled on the NEI side, does renaming HeightHack to CompatibilityHacks (only the class, not touching csv) seem reasonable? |
Sounds good. Can you maybe move the code lines so that we have the height hack overrides together and then separately the currentScreen override. That is, move |
This should be ready for review now. PTAL! |
Fix bad lighting in recipe tooltips and sometimes blank tooltips for handlers that expect the current GUI screen to be a GuiRecipe.
Fixes GTNewHorizons/GT-New-Horizons-Modpack#13954