use of logisticspipes.interfaces.IHUDModuleHandler in project LogisticsPipes by RS485.
the class HudChassisPipe method renderHeadUpDisplay.
@Override
public void renderHeadUpDisplay(double distance, boolean day, boolean shifted, Minecraft mc, IHUDConfig config) {
if (day) {
GL11.glColor4b((byte) 64, (byte) 64, (byte) 64, (byte) 64);
} else {
GL11.glColor4b((byte) 127, (byte) 127, (byte) 127, (byte) 64);
}
GuiGraphics.drawGuiBackGround(mc, -50, -50, 50, 50, 0, false);
if (day) {
GL11.glColor4b((byte) 64, (byte) 64, (byte) 64, (byte) 127);
} else {
GL11.glColor4b((byte) 127, (byte) 127, (byte) 127, (byte) 127);
}
GL11.glTranslatef(0.0F, 0.0F, (float) (-0.00005F * distance));
super.renderHeadUpDisplay(distance, day, shifted, mc, config);
if (selected != -1) {
LogisticsModule selectedmodule = module.getSubModule(selected);
if (selectedmodule == null) {
return;
}
GL11.glColor4b((byte) 127, (byte) 127, (byte) 127, (byte) 64);
GuiGraphics.drawGuiBackGround(mc, -23, -35, 45, 45, 0, false);
GL11.glColor4b((byte) 127, (byte) 127, (byte) 127, (byte) 127);
if (selectedmodule instanceof IHUDModuleHandler && ((IHUDModuleHandler) selectedmodule).getHUDRenderer() != null) {
GL11.glTranslatef(11.0F, 5.0F, (float) (-0.00005F * distance));
((IHUDModuleHandler) selectedmodule).getHUDRenderer().renderContent(shifted);
if (((IHUDModuleHandler) selectedmodule).getHUDRenderer().getButtons() != null) {
for (IHUDButton button : ((IHUDModuleHandler) selectedmodule).getHUDRenderer().getButtons()) {
button.renderAlways(shifted);
if (button.shouldRenderButton()) {
button.renderButton(button.isFocused(), button.isblockFocused(), shifted);
}
if (!button.buttonEnabled() || !button.shouldRenderButton()) {
continue;
}
if ((button.getX() - 1 < (xCursor - 11) && (xCursor - 11) < (button.getX() + button.sizeX() + 1)) && (button.getY() - 1 < (yCursor - 5) && (yCursor - 5) < (button.getY() + button.sizeY() + 1))) {
if (!button.isFocused() && !button.isblockFocused()) {
button.setFocused();
} else if (button.focusedTime() > 400 && !button.isblockFocused()) {
button.clicked();
button.blockFocused();
}
} else if (button.isFocused() || button.isblockFocused()) {
button.clearFocused();
}
}
}
GL11.glTranslatef(-11.0F, -5.0F, (float) (0.00005F * distance));
} else {
GL11.glTranslatef(0.0F, 0.0F, (float) (-0.00005F * distance));
mc.fontRenderer.drawString("Nothing", -5, -15, 0);
mc.fontRenderer.drawString("to", 9, -5, 0);
mc.fontRenderer.drawString("display", -5, 5, 0);
GL11.glTranslatef(0.0F, 0.0F, (float) (0.00005F * distance));
}
} else {
GL11.glTranslatef(0.0F, 0.0F, (float) (-0.005F * distance));
GL11.glScalef(1.5F, 1.5F, 0.0001F);
GL11.glScalef(0.8F, 0.8F, -1F);
ItemStackRenderer.renderItemIdentifierStackListIntoGui(pipe.displayList, null, 0, -15, -35, 3, 12, 18, 18, 100.0F, DisplayAmount.ALWAYS, true, false, shifted);
}
GL11.glTranslatef(0.0F, 0.0F, (float) (0.00005F * distance));
}
Aggregations