GregTechCEu / GregTech

GregTech CE 1.12 fork continuing progression and development
GNU Lesser General Public License v3.0
226 stars 170 forks source link

Add JEI text-button to see JEI Recipes ran at higher tiers #2468

Open vrejhead opened 1 month ago

vrejhead commented 1 month ago

What

Adds an interactable overclock text in JEI to see recipe EU/t and speed at different voltage tiers, clicking on the text changes the overclock tier. Left clicking on the text increases the OC tier, while right clicking decreases it. Both wrap around as necessary, with the max tier being specified below and min tier being the lowest tier the recipe will run at. This PR also adds voltage colors to the JEI EU/t display.

Implementation Details

Adds a JeiInteractableText to handle the interactable text. RecipeMaps can disable this overclock button(such as research recipemaps or generator recipemaps) with the .disableJeiOverclockButton() method on both RecipeMapBuilder and RecipeMap.

This PR currently only assumes 4xEUt/2xSpeed overclocking, with the exception of:

Currently this button only goes up to UIV if highTier is disabled, and MAX if it is enabled(maybe like "MAX+1" if MAX+ OC was implemented?) An exception is if highTier is disabled, but there is a recipe which is incorrectly registered as UXV or above, then for that recipe only the max overclocking button tier is the tier of the recipe(so you cannot change the overclocking tier at all, since min tier equals max tier in this case)

Outcome

There is now a JEI button to "calculate" overclocks. Currently the tooltip builder in JeiInteractableButton renders the tooltip below the ingredients, I currently don't know of any way to fix this. This should be fine for this PR since the button is at the bottom right, so no ingredients should overlay. image

These screenshots are with highTier enabled, without it, the max tier would be UIV

The position of the text is very sus because during click handling you aren't given the recipe height and width, which makes it impossible to align with respect to the south border(afaik recipeWidth is always 176, while recipeHeight is variable), since different RecipeMaps have different recipeHeights. The spot avoids all recipes, while being far enough away from the south border than it is inside the border for all RecipeMaps(top left has conflicts with assembly line, top right has conflicts with arc furnace)

The base recipe image The recipe now only takes one tick image Because the UXV recipe took one tick, this is yellow since you are not gaining speed from the overclock(s) image After another click reaching MAX tier, the next left click will wrap around to LuV tier.

Potential Compatibility Issues

This has conflicts with #2432 . Don't think it would be too bad, just changing some ints to longs for this PR, only questionable one is GTRecipeWrapper though. Also likely NonParallelSubtickOC will be the default, instead of just yellow text.