Slot Highlighting Overlay Option (#458)

* Add option to highlight the entire slot instead of showing an icon for recipe overlay

* Move skip to full slot highlight only
This commit is contained in:
Caedis authored and GitHub committed 2024-02-19 13:12:01 +01:00
1 parent 94ca7f3134
commit db1fd255bb
4 files changed
+30 -4

No files matched your search

@@ -825,9 +825,22 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
drawTexturedModalRect(x2, y2, tx2, ty2, w2, h2); // bottom right
}
public static void drawItemPresenceOverlay(int slotX, int slotY, boolean isPresent) {
Image icon = itemPresenceOverlays[isPresent ? 1 : 0];
drawIcon(slotX + 16 - icon.width, slotY + 16 - icon.height, icon);
public static void drawItemPresenceOverlay(int slotX, int slotY, boolean isPresent, boolean slotHighlight) {
if (slotHighlight) {
if (isPresent) return;
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_DEPTH_TEST);
GL11.glTranslatef(0, 0, -150);
drawRect(slotX, slotY, 16, 16, 0x80AA0000);
GL11.glTranslatef(0, 0, 150);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_DEPTH_TEST);
} else {
Image icon = itemPresenceOverlays[isPresent ? 1 : 0];
drawIcon(slotX + 16 - icon.width, slotY + 16 - icon.height, icon);
}
}
public static LayoutManager instance() {
@@ -289,6 +289,11 @@ public class NEIClientConfig {
.setComment("Require holding shift to move items when overlaying recipe").getBooleanValue(true);
API.addOption(new OptionToggleButton("inventory.shift_overlay_recipe", true));
tag.getTag("inventory.slotHighlight")
.setComment("Highlight the entire slot instead of just showing an icon for the recipe overlay")
.getBooleanValue(true);
API.addOption(new OptionToggleButton("inventory.slotHighlight", true));
tag.getTag("tools.handler_load_from_config").setComment("ADVANCED: Load handlers from config")
.getBooleanValue(false);
API.addOption(new OptionToggleButton("tools.handler_load_from_config", true) {
@@ -629,6 +634,10 @@ public class NEIClientConfig {
return getBooleanSetting("inventory.shift_overlay_recipe");
}
public static boolean isSlotHighlightEnabled() {
return getBooleanSetting("inventory.slotHighlight");
}
public static boolean isEnabled() {
return enabledOverride && getBooleanSetting("inventory.widgetsenabled");
}
@@ -1011,6 +1011,7 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
}
final boolean drawItemPresence = NEIClientConfig.isJEIStyleItemPresenceOverlayVisible();
final boolean slotHighlight = NEIClientConfig.isSlotHighlightEnabled();
GL11.glPushMatrix();
GL11.glTranslatef(5, 32 - ySkip + yShift, 0);
@@ -1036,7 +1037,7 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
for (int j = 0; j < ingredients.size(); j++) {
PositionedStack stack = ingredients.get(j);
boolean isPresent = itemPresenceCacheSlots.get(j);
LayoutManager.drawItemPresenceOverlay(stack.relx, stack.rely, isPresent);
LayoutManager.drawItemPresenceOverlay(stack.relx, stack.rely, isPresent, slotHighlight);
}
}