2014-04-29 10:54:20 +10:00
|
|
|
package codechicken.nei.api;
|
|
|
|
|
|
2023-09-25 00:34:42 +02:00
|
|
|
import codechicken.nei.PositionedStack;
|
|
|
|
|
import codechicken.nei.guihook.GuiContainerManager;
|
2022-06-24 12:32:13 +01:00
|
|
|
import net.minecraft.inventory.Slot;
|
|
|
|
|
import org.lwjgl.opengl.GL11;
|
2014-04-29 10:54:20 +10:00
|
|
|
|
2023-09-25 00:34:42 +02:00
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.List;
|
2023-01-28 17:55:51 -08:00
|
|
|
|
2022-06-24 12:32:13 +01:00
|
|
|
public class DefaultOverlayRenderer implements IRecipeOverlayRenderer {
|
2023-01-28 17:55:51 -08:00
|
|
|
|
2022-06-24 12:32:13 +01:00
|
|
|
public DefaultOverlayRenderer(List<PositionedStack> ai, IStackPositioner positioner) {
|
2014-04-29 10:54:20 +10:00
|
|
|
positioner = this.positioner = positioner;
|
2019-12-30 20:19:16 -08:00
|
|
|
ingreds = new ArrayList<>();
|
2022-06-24 12:32:13 +01:00
|
|
|
for (PositionedStack stack : ai) ingreds.add(stack.copy());
|
2014-04-29 10:54:20 +10:00
|
|
|
ingreds = positioner.positionStacks(ingreds);
|
|
|
|
|
}
|
2022-06-24 12:32:13 +01:00
|
|
|
|
2014-04-29 10:54:20 +10:00
|
|
|
@Override
|
2022-06-24 12:32:13 +01:00
|
|
|
public void renderOverlay(GuiContainerManager gui, Slot slot) {
|
2014-04-29 10:54:20 +10:00
|
|
|
GL11.glEnable(GL11.GL_BLEND);
|
|
|
|
|
GL11.glBlendFunc(770, 1);
|
|
|
|
|
GL11.glColor4d(0.6, 0.6, 0.6, 0.7);
|
2022-06-24 12:32:13 +01:00
|
|
|
|
2014-04-29 10:54:20 +10:00
|
|
|
GuiContainerManager.setColouredItemRender(true);
|
2022-06-24 12:32:13 +01:00
|
|
|
for (PositionedStack stack : ingreds) {
|
|
|
|
|
if (stack.relx == slot.xDisplayPosition && stack.rely == slot.yDisplayPosition)
|
2014-04-29 10:54:20 +10:00
|
|
|
GuiContainerManager.drawItem(stack.relx, stack.rely, stack.item);
|
|
|
|
|
}
|
|
|
|
|
GuiContainerManager.setColouredItemRender(false);
|
2022-06-24 12:32:13 +01:00
|
|
|
|
2014-04-29 10:54:20 +10:00
|
|
|
GL11.glColor4f(1, 1, 1, 1);
|
|
|
|
|
GL11.glDisable(GL11.GL_BLEND);
|
|
|
|
|
GL11.glEnable(GL11.GL_LIGHTING);
|
|
|
|
|
}
|
2022-06-24 12:32:13 +01:00
|
|
|
|
2019-12-30 20:19:16 -08:00
|
|
|
final IStackPositioner positioner;
|
2014-04-29 10:54:20 +10:00
|
|
|
ArrayList<PositionedStack> ingreds;
|
|
|
|
|
}
|