Improve recipe screen (#1165)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
slprimeandgithub-actions[bot] authored and GitHub committed 2026-11-28 17:21:57 +02:00
1 parent 6e6b8539f3
commit ebfdff501d
53 files changed
+1685 -958

No files matched your search

@@ -0,0 +1,57 @@
package codechicken.nei.drawable;
public interface Drawable {
@FunctionalInterface
public interface Painter {
public void draw(int x, int y, int width, int height);
}
public int getWidth();
public int getHeight();
public void draw(int x, int y, int width, int height);
default void draw(int x, int y) {
draw(x, y, getWidth(), getHeight());
}
public static Drawable of(int width, int height, Painter painter) {
return new Drawable() {
@Override
public int getWidth() {
return width;
}
@Override
public int getHeight() {
return height;
}
@Override
public void draw(int x, int y, int w, int h) {
painter.draw(x, y, w, h);
}
};
}
// every layer is drawn into the whole rectangle, the first one at the bottom
public static Drawable stack(Drawable... layers) {
int width = 0;
int height = 0;
for (Drawable layer : layers) {
width = Math.max(width, layer.getWidth());
height = Math.max(height, layer.getHeight());
}
return of(width, height, (x, y, w, h) -> {
for (Drawable layer : layers) {
layer.draw(x, y, w, h);
}
});
}
}
@@ -8,7 +8,7 @@ import org.lwjgl.opengl.GL11;
import codechicken.nei.Image;
public class DrawableResource extends Image {
public class DrawableResource extends Image implements Drawable {
private final ResourceLocation resourceLocation;
private final int textureWidth;