Compare commits

..
Author SHA1 Message Date
4f42175b56 Move shared button and scrollbar textures to UIWidgetTexture (#1158) (#1163)
Co-authored-by: slprime <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-11-24 22:07:53 +01:00
boubou19andslprime 292c68ef44 Rebuild recipe catalysts only when something changes (#1157) (#1162)
Co-authored-by: slprime <[email protected]>
2026-11-24 22:07:32 +01:00
2326460ac0 Clear bookmark group tooltip when pulling items or changing quantities (#1152) (#1161)
Co-authored-by: gorbit99 <[email protected]>
Co-authored-by: slprime <[email protected]>
2026-11-24 22:06:58 +01:00
boubou19andOrderedSet86 8731ae82f2 Less hacky fix for light opacity 0 blocks (#1124) (#1148)
Co-authored-by: OrderedSet86 <[email protected]>
2026-11-20 21:38:44 +01:00
boubou19andgorbit99 558449ca99 Change layout recalculation order (#1125) (#1147)
Co-authored-by: gorbit99 <[email protected]>
2026-11-20 21:34:18 +01:00
boubou19andslprime 7fc80371c7 Copy fluid registry name instead of the display item id (#1122) (#1145)
Co-authored-by: slprime <[email protected]>
2026-11-19 08:17:47 +01:00
f5f696abba Add NEI mob spawn overlay variants (#1111) (#1144)
Co-authored-by: OrderedSet86 <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Martin Robertz <[email protected]>
2026-11-19 08:15:31 +01:00
boubou19andslprime 277c32b9e6 Don't toggle handler info widget while typing in recipe search (#1121) (#1143)
Co-authored-by: slprime <[email protected]>
2026-11-19 08:13:15 +01:00
boubou19andslprime fbb0cdc81a Add recipe text search with ~ prefix (#1120) (#1142)
Co-authored-by: slprime <[email protected]>
2026-11-19 08:11:11 +01:00
boubou19andslprime 991e166e0a Speed up GUID cache and bookmark recipe lookups (#1119) (#1141)
Co-authored-by: slprime <[email protected]>
2026-11-19 08:08:48 +01:00
d298c0e827 Don't copy stack unless it changed (#1116) (#1140)
Co-authored-by: DarkShadow44 <[email protected]>
Co-authored-by: slprime <[email protected]>
2026-11-19 08:06:32 +01:00
boubou19andslprime da16b40f36 Optimize GUI overlap scan for item panels (#1118) (#1139)
Co-authored-by: slprime <[email protected]>
2026-11-19 08:02:56 +01:00
boubou19andslprime 651b59cba9 Fix WorldClient leak after leaving the world (#1115) (#1138)
Co-authored-by: slprime <[email protected]>
2026-11-19 08:00:50 +01:00
boubou19andslprime f922d7ef1e Make name optional in API.addCollapsibleGroup (#1114) (#1137)
Co-authored-by: slprime <[email protected]>
2026-11-19 07:57:05 +01:00
boubou19andslprime 52ad6f38a5 Add API.addCollapsibleGroup for registering collapsible item groups (#1113) (#1136)
Co-authored-by: slprime <[email protected]>
2026-11-19 07:52:58 +01:00
boubou19andslprime 8d118cb132 Rollback fluent setters in PositionedStack added in #1106 (#1110) (#1135)
Co-authored-by: slprime <[email protected]>
2026-11-19 07:50:30 +01:00
boubou19andslprime 2590eec44a Fix NPE in StackInfo.getItemStackWithMinimumDamage for unregistered items (#1109) (#1134)
Co-authored-by: slprime <[email protected]>
2026-11-19 07:48:46 +01:00
boubou19andslprime 81a92a28f5 Remove creative tab style option for recipe tabs (#1107) (#1133)
Co-authored-by: slprime <[email protected]>
2026-11-19 07:46:47 +01:00
boubou19andslprime 621ab621c7 Move RecipeTransferRectHandler out of TemplateRecipeHandler and tidy up PositionedStack (#1106) (#1132)
Co-authored-by: slprime <[email protected]>
2026-11-19 07:44:56 +01:00
boubou19andslprime 1aa4d56100 Add getResultStacks/getAuxiliaryStacks to IRecipeHandler (#1105) (#1131)
Co-authored-by: slprime <[email protected]>
2026-11-19 07:42:56 +01:00
boubou19andslprime dc35985ea0 Stop auto-creating NEI config files, add export buttons instead (#1104) (#1130)
Co-authored-by: slprime <[email protected]>
2026-11-19 07:40:46 +01:00
boubou19andslprime bb8632a012 Fix ConcurrentModificationException when iterating the crafting recipe list (#1103) (#1129)
Co-authored-by: slprime <[email protected]>
2026-11-19 07:38:03 +01:00
b361604422 Remove per-world config override (#1094) (#1128)
Co-authored-by: slprime <[email protected]>
Co-authored-by: Martin Robertz <[email protected]>
2026-11-19 07:35:55 +01:00
boubou19andslprime 02c97a05c3 Remove hardcoded vanilla block name overrides (#1102) (#1127)
Co-authored-by: slprime <[email protected]>
2026-11-19 07:33:11 +01:00
boubou19andArmisael5 d0785b5261 Add NEI Recipe Exporting (#1100) (#1126)
Co-authored-by: Armisael5 <[email protected]>
2026-11-19 07:31:13 +01:00
UltraProdigy 52ae4b2bd4 ci: run build and test on release branches 2026-11-09 01:11:41 -05:00
slprime acacd13bd9 Fix autocraft crash when started from the recipe screen (#1108) 2026-11-06 00:31:19 +02:00
12 changed files with 184 additions and 24 deletions

No files matched your search

@@ -52,14 +52,7 @@ class CraftingTreeToolbar {
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glTranslated(iconX, iconY, 0);
GL11.glScalef(0.5f, 0.5f, 1);
icon.bindTexture();
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
icon.draw(0, 0);
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST);
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);
GL11.glDisable(GL11.GL_BLEND);
GL11.glPopMatrix();
}
@@ -220,8 +220,9 @@ public class DrawableResource extends Image {
final float scaleU = 1.0F / this.textureWidth;
final float scaleV = 1.0F / this.textureHeight;
final int x = xOffset + this.paddingLeft;
final int y = yOffset + this.paddingTop;
// 1/64 shift keeps pixel centers off texel edges, where NEAREST picks a texel at random when downscaled
final double x = xOffset + this.paddingLeft + 1 / 64d;
final double y = yOffset + this.paddingTop + 1 / 64d;
final float u0 = (this.x + u) * scaleU;
final float u1 = (this.x + u + width) * scaleU;
final float v0 = (this.y + v) * scaleV;
@@ -59,6 +59,7 @@ import codechicken.nei.scroll.ScrollBar.OverflowType;
import codechicken.nei.scroll.ScrollBar.ScrollPlace;
import codechicken.nei.scroll.ScrollContainer;
import codechicken.nei.search.SearchExpressionUtils;
import codechicken.nei.theme.UIWidgetTexture;
import codechicken.nei.util.EmptyContainer;
import codechicken.nei.util.SlotInaccessible;
@@ -533,7 +534,7 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
if (!this.handlerInfo.isAllowOverflowX() && this.handlerInfo.getWidth() > this.xSize - 6) {
this.container.setPaddingInline(0, 2);
this.container.setHorizontalScroll(ScrollBar.defaultHorizontalBar().setTrackPadding(1, 0, 1, 0));
this.container.setHorizontalScroll(UIWidgetTexture.horizontalScrollBar().setTrackPadding(1, 0, 1, 0));
} else {
this.container.setPaddingInline(0, 0);
this.container.setHorizontalScroll(null);
@@ -545,7 +546,7 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
this.container.setVerticalScroll(VERTICAL_SCROLLBAR);
} else {
this.container.setVerticalScroll(
ScrollBar.defaultVerticalBar().setOverflowType(OverflowType.OVERLAY)
UIWidgetTexture.verticalScrollBar().setOverflowType(OverflowType.OVERLAY)
.setTrackPadding(-8, 0, 0, 0));
}
}
@@ -4,10 +4,14 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import net.minecraft.client.Minecraft;
import net.minecraftforge.client.event.GuiScreenEvent;
import codechicken.lib.vec.Rectangle4i;
import codechicken.nei.GuiNEIButton;
import codechicken.nei.drawable.DrawableResource;
import codechicken.nei.theme.ButtonSkin;
import codechicken.nei.theme.UIWidgetTexture;
import cpw.mods.fml.common.eventhandler.Cancelable;
public abstract class GuiRecipeButton extends GuiNEIButton {
@@ -58,6 +62,26 @@ public abstract class GuiRecipeButton extends GuiNEIButton {
this.handlerRef = point;
}
protected DrawableResource getIcon() {
return null;
}
@Override
protected DrawableResource getBackground(int mouseX, int mouseY, boolean mouseOver) {
return UIWidgetTexture.BUTTON.background(this.enabled, false, mouseOver);
}
@Override
protected void drawContent(Minecraft minecraft, int mouseX, int mouseY, boolean mouseOver) {
final DrawableResource icon = getIcon();
if (icon != null) {
ButtonSkin.drawIcon(this.xPosition, this.yPosition, this.width, this.height, icon, this.enabled);
} else {
super.drawContent(minecraft, mouseX, mouseY, mouseOver);
}
}
public abstract List<String> handleTooltip(List<String> currenttip);
public abstract Map<String, String> handleHotkeys(int mousex, int mousey, Map<String, String> hotkeys);
@@ -18,6 +18,7 @@ import codechicken.nei.drawable.DrawableResource;
import codechicken.nei.guihook.GuiContainerManager;
import codechicken.nei.scroll.ScrollBar;
import codechicken.nei.scroll.ScrollContainer;
import codechicken.nei.theme.UIWidgetTexture;
public class GuiRecipeCatalyst extends ScrollContainer {
@@ -68,7 +69,7 @@ public class GuiRecipeCatalyst extends ScrollContainer {
private static final DrawableResource FG_TEXTURE = new DrawableBuilder("nei:textures/slot.png", 0, 0, 18, 18)
.setTextureSize(18, 18).setSlices(1, 1, 1, 1).build();
private static final ScrollBar VERTICAL_SCROLLBAR = ScrollBar.defaultVerticalBar()
private static final ScrollBar VERTICAL_SCROLLBAR = UIWidgetTexture.verticalScrollBar()
.setOverflowType(ScrollBar.OverflowType.AUTO).setTrackPadding(0, BORDER_PADDING, -13, BORDER_PADDING)
.setScrollPlace(ScrollBar.ScrollPlace.START);
@@ -6,8 +6,8 @@ import org.lwjgl.opengl.GL11;
import codechicken.lib.vec.Rectangle4i;
import codechicken.nei.NEIClientUtils;
import codechicken.nei.drawable.DrawableBuilder;
import codechicken.nei.drawable.DrawableResource;
import codechicken.nei.theme.UIWidgetTexture;
public class ScrollBar {
@@ -59,21 +59,14 @@ public class ScrollBar {
return new ScrollBar();
}
@Deprecated
public static ScrollBar defaultVerticalBar() {
return new ScrollBar().setTrackWidth(8).setTrackTexture(
new DrawableBuilder("nei:textures/nei_sprites.png", 29, 95, 8, 11).setSlices(0, 0, 3, 4).build())
.setThumbTexture(
new DrawableBuilder("nei:textures/nei_sprites.png", 22, 96, 6, 9).setSlices(0, 0, 3, 2).build())
.setThumbPadding(1, 1, 1, 1);
return UIWidgetTexture.verticalScrollBar();
}
@Deprecated
public static ScrollBar defaultHorizontalBar() {
return new ScrollBar().setTrackWidth(8).setOverflowType(OverflowType.SCROLL)
.setTrackTexture(
new DrawableBuilder("nei:textures/nei_sprites.png", 0, 97, 11, 8).setSlices(3, 4, 0, 0).build())
.setThumbTexture(
new DrawableBuilder("nei:textures/nei_sprites.png", 12, 98, 9, 6).setSlices(3, 2, 0, 0).build())
.setThumbPadding(1, 1, 1, 1);
return UIWidgetTexture.horizontalScrollBar();
}
/**
@@ -0,0 +1,44 @@
package codechicken.nei.theme;
import org.lwjgl.opengl.GL11;
import codechicken.nei.drawable.DrawableResource;
public final class ButtonSkin {
private final DrawableResource normal;
private final DrawableResource hover;
private final DrawableResource active;
private final DrawableResource disabled;
public ButtonSkin(DrawableResource normal, DrawableResource hover, DrawableResource active,
DrawableResource disabled) {
this.normal = normal;
this.hover = hover;
this.active = active;
this.disabled = disabled;
}
public DrawableResource background(boolean enabled, boolean active, boolean hovered) {
if (!enabled) return this.disabled;
if (active) return this.active;
return hovered ? this.hover : this.normal;
}
public void draw(int x, int y, int w, int h, DrawableResource icon, boolean enabled, boolean active,
boolean hovered) {
GL11.glColor4f(1, 1, 1, 1);
background(enabled, active, hovered).draw(x, y, w, h);
drawIcon(x, y, w, h, icon, enabled);
}
public static void drawIcon(int x, int y, int w, int h, DrawableResource icon, boolean enabled) {
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glColor4f(1, 1, 1, enabled ? 1 : 0.5f);
icon.draw(x + (w - icon.getWidth()) / 2, y + (h - icon.getHeight()) / 2);
GL11.glDisable(GL11.GL_BLEND);
GL11.glColor4f(1, 1, 1, 1);
}
}
@@ -0,0 +1,58 @@
package codechicken.nei.theme;
import net.minecraft.util.ResourceLocation;
import codechicken.nei.drawable.DrawableResource;
public final class UISprite {
public static final int[] DEFAULT_SPACE = new int[] { 0, 0, 0, 0 };
private UISprite() {}
public static DrawableResource of(String name, int w, int h, int[] margin, int[] slice) {
return frames(name, w, h, 1, margin, slice)[0];
}
public static DrawableResource of(String name, int w, int h) {
return of(name, w, h, DEFAULT_SPACE, DEFAULT_SPACE);
}
public static DrawableResource[] frames(String name, int w, int h, int count) {
return frames(name, w, h, count, DEFAULT_SPACE, DEFAULT_SPACE);
}
// frames are stacked top to bottom and each includes the margin; {left, top, right, bottom}
public static DrawableResource[] frames(String name, int w, int h, int count, int[] margin, int[] slice) {
final ResourceLocation texture = new ResourceLocation("nei", "textures/gui/" + name + ".png");
final int frameWidth = w + margin[0] + margin[2];
final int frameHeight = h + margin[1] + margin[3];
final DrawableResource[] frames = new DrawableResource[count];
for (int i = 0; i < count; i++) {
frames[i] = new DrawableResource(
texture,
0,
i * frameHeight,
frameWidth,
frameHeight,
-margin[1],
-margin[3],
-margin[0],
-margin[2],
frameWidth,
frameHeight * count,
slice[0] + margin[0],
slice[2] + margin[2],
slice[1] + margin[1],
slice[3] + margin[3]);
}
return frames;
}
}
@@ -0,0 +1,45 @@
package codechicken.nei.theme;
import codechicken.nei.drawable.DrawableResource;
import codechicken.nei.scroll.ScrollBar;
import codechicken.nei.scroll.ScrollBar.ScrollType;
public final class UIWidgetTexture {
private static final DrawableResource[] BTN = UISprite
.frames("widgets/button", 12, 12, 4, UISprite.DEFAULT_SPACE, new int[] { 2, 2, 2, 3 });
public static final DrawableResource BTN_NORMAL = BTN[0];
public static final DrawableResource BTN_HOVER = BTN[1];
public static final DrawableResource BTN_ACTIVE = BTN[2];
public static final DrawableResource BTN_DISABLED = BTN[3];
public static final ButtonSkin BUTTON = new ButtonSkin(BTN_NORMAL, BTN_HOVER, BTN_ACTIVE, BTN_DISABLED);
private static final int[] THUMB_INSET = new int[] { 1, 1, 1, 1 };
// frame 0 is the track, frame 1 the thumb drawn inside a transparent THUMB_INSET border of the same frame size
public static final DrawableResource SCROLL_V_TRACK = UISprite
.frames("widgets/scroll_v", 8, 11, 2, UISprite.DEFAULT_SPACE, new int[] { 1, 1, 1, 1 })[0];
public static final DrawableResource SCROLL_V_THUMB = UISprite
.frames("widgets/scroll_v", 6, 9, 2, THUMB_INSET, new int[] { 1, 1, 1, 2 })[1];
public static final DrawableResource SCROLL_H_TRACK = UISprite
.frames("widgets/scroll_h", 11, 8, 2, UISprite.DEFAULT_SPACE, new int[] { 1, 1, 1, 1 })[0];
public static final DrawableResource SCROLL_H_THUMB = UISprite
.frames("widgets/scroll_h", 9, 6, 2, THUMB_INSET, new int[] { 1, 1, 2, 1 })[1];
public static final int SCROLL_TRACK_WIDTH = 8;
private UIWidgetTexture() {}
public static ScrollBar verticalScrollBar() {
return new ScrollBar().setTrackWidth(SCROLL_TRACK_WIDTH).setTrackTexture(SCROLL_V_TRACK)
.setThumbTexture(SCROLL_V_THUMB).setThumbPadding(1, 1, 1, 1);
}
public static ScrollBar horizontalScrollBar() {
return new ScrollBar().setScrollType(ScrollType.HORIZONTAL).setTrackWidth(SCROLL_TRACK_WIDTH)
.setTrackTexture(SCROLL_H_TRACK).setThumbTexture(SCROLL_H_THUMB).setThumbPadding(1, 1, 1, 1);
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 173 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 149 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 151 B