use of com.simibubi.create.foundation.gui.AllGuiTextures in project Create by Creators-of-Create.
the class ToolSelectionScreen method draw.
private void draw(PoseStack matrixStack, float partialTicks) {
Window mainWindow = minecraft.getWindow();
if (!initialized)
init(minecraft, mainWindow.getGuiScaledWidth(), mainWindow.getGuiScaledHeight());
int x = (mainWindow.getGuiScaledWidth() - w) / 2 + 15;
int y = mainWindow.getGuiScaledHeight() - h - 75;
matrixStack.pushPose();
matrixStack.translate(0, -yOffset, focused ? 100 : 0);
AllGuiTextures gray = AllGuiTextures.HUD_BACKGROUND;
RenderSystem.enableBlend();
RenderSystem.setShaderColor(1, 1, 1, focused ? 7 / 8f : 1 / 2f);
RenderSystem.setShaderTexture(0, gray.location);
blit(matrixStack, x - 15, y, gray.startX, gray.startY, w, h, gray.width, gray.height);
float toolTipAlpha = yOffset / 10;
List<Component> toolTip = tools.get(selection).getDescription();
int stringAlphaComponent = ((int) (toolTipAlpha * 0xFF)) << 24;
if (toolTipAlpha > 0.25f) {
RenderSystem.setShaderColor(.7f, .7f, .8f, toolTipAlpha);
blit(matrixStack, x - 15, y + 33, gray.startX, gray.startY, w, h + 22, gray.width, gray.height);
RenderSystem.setShaderColor(1, 1, 1, 1);
if (toolTip.size() > 0)
font.draw(matrixStack, toolTip.get(0), x - 10, y + 38, 0xEEEEEE + stringAlphaComponent);
if (toolTip.size() > 1)
font.draw(matrixStack, toolTip.get(1), x - 10, y + 50, 0xCCDDFF + stringAlphaComponent);
if (toolTip.size() > 2)
font.draw(matrixStack, toolTip.get(2), x - 10, y + 60, 0xCCDDFF + stringAlphaComponent);
if (toolTip.size() > 3)
font.draw(matrixStack, toolTip.get(3), x - 10, y + 72, 0xCCCCDD + stringAlphaComponent);
}
RenderSystem.setShaderColor(1, 1, 1, 1);
if (tools.size() > 1) {
String keyName = AllKeys.TOOL_MENU.getBoundKey();
int width = minecraft.getWindow().getGuiScaledWidth();
if (!focused)
drawCenteredString(matrixStack, minecraft.font, Lang.translate(holdToFocus, keyName), width / 2, y - 10, 0xCCDDFF);
else
drawCenteredString(matrixStack, minecraft.font, scrollToCycle, width / 2, y - 10, 0xCCDDFF);
} else {
x += 65;
}
for (int i = 0; i < tools.size(); i++) {
matrixStack.pushPose();
float alpha = focused ? 1 : .2f;
if (i == selection) {
matrixStack.translate(0, -10, 0);
drawCenteredString(matrixStack, minecraft.font, tools.get(i).getDisplayName().getString(), x + i * 50 + 24, y + 28, 0xCCDDFF);
alpha = 1;
}
RenderSystem.setShaderColor(0, 0, 0, alpha);
tools.get(i).getIcon().render(matrixStack, x + i * 50 + 16, y + 12, this);
RenderSystem.setShaderColor(1, 1, 1, alpha);
tools.get(i).getIcon().render(matrixStack, x + i * 50 + 16, y + 11, this);
matrixStack.popPose();
}
RenderSystem.enableBlend();
matrixStack.popPose();
}
Aggregations