Skip to content

Commit

Permalink
Slot Highlighting Overlay Option (GTNewHorizons#458)
Browse files Browse the repository at this point in the history
* Add option to highlight the entire slot instead of showing an icon for recipe overlay

* Move skip to full slot highlight only
  • Loading branch information
Caedis authored Feb 19, 2024
1 parent 94ca7f3 commit db1fd25
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 4 deletions.
19 changes: 16 additions & 3 deletions src/main/java/codechicken/nei/LayoutManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -825,9 +825,22 @@ public static void drawButtonBackground(int x, int y, int w, int h, boolean edge
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() {
Expand Down
9 changes: 9 additions & 0 deletions src/main/java/codechicken/nei/NEIClientConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,11 @@ public boolean onClick(int button) {
.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) {
Expand Down Expand Up @@ -629,6 +634,10 @@ public static boolean requireShiftForOverlayRecipe() {
return getBooleanSetting("inventory.shift_overlay_recipe");
}

public static boolean isSlotHighlightEnabled() {
return getBooleanSetting("inventory.slotHighlight");
}

public static boolean isEnabled() {
return enabledOverride && getBooleanSetting("inventory.widgetsenabled");
}
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/codechicken/nei/recipe/GuiRecipe.java
Original file line number Diff line number Diff line change
Expand Up @@ -1011,6 +1011,7 @@ public void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
}

final boolean drawItemPresence = NEIClientConfig.isJEIStyleItemPresenceOverlayVisible();
final boolean slotHighlight = NEIClientConfig.isSlotHighlightEnabled();

GL11.glPushMatrix();
GL11.glTranslatef(5, 32 - ySkip + yShift, 0);
Expand All @@ -1036,7 +1037,7 @@ public void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
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);
}
}

Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/assets/nei/lang/en_US.lang
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,9 @@ nei.options.inventory.jei_style_cycled_ingredients.false=No
nei.options.inventory.shift_overlay_recipe=Require holding shift to move items when overlaying recipe
nei.options.inventory.shift_overlay_recipe.true=Yes
nei.options.inventory.shift_overlay_recipe.false=No
nei.options.inventory.slotHighlight=Highlight the entire slot instead of just showing an icon for the recipe overlay
nei.options.inventory.slotHighlight.true=Yes
nei.options.inventory.slotHighlight.false=No
nei.options.inventory.widgetsenabled.true=NEI Enabled
nei.options.inventory.widgetsenabled.false=NEI Disabled
nei.options.inventory.cheatmode.0=Recipe Mode
Expand Down

0 comments on commit db1fd25

Please sign in to comment.