Skip to content
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

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

Open
wants to merge 24 commits into
base: master
Choose a base branch
from

Conversation

vrejhead
Copy link
Contributor

@vrejhead vrejhead commented May 4, 2024

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:

  • fusion RecipeMap - 2xEUt/2xSpeed
  • LCR RecipeMap - 4xEUt/4xSpeed

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.

@vrejhead vrejhead marked this pull request as ready for review May 4, 2024 20:24
@vrejhead vrejhead requested a review from a team as a code owner May 4, 2024 20:24
@ALongStringOfNumbers ALongStringOfNumbers added the type: feature New feature or request label May 4, 2024
Zorbatron and others added 5 commits August 4, 2024 21:33
# Conflicts:
#	src/main/java/gregtech/api/recipes/RecipeMapBuilder.java
#	src/main/java/gregtech/api/recipes/RecipeMaps.java
#	src/main/java/gregtech/integration/jei/recipe/GTRecipeWrapper.java
Make it work after merging in main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants