Java Code Examples for com.mojang.blaze3d.platform.GlStateManager#enableBlend()

The following examples show how to use com.mojang.blaze3d.platform.GlStateManager#enableBlend() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DownloadScreen.java    From Sandbox with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void render(int mouseX, int mouseY, float partialTicks) {
    super.render(mouseX, mouseY, partialTicks);
    String right = "Preparing Addon " + addon + " of " + dls.length;
    String right2 = "";
    if (dl.hasStarted()) {
        right = "Downloading Addon " + addon + " of " + dls.length;
        int percent = (int) ((dl.getCurrentSize() * 100) / dl.getTotalSize());
        right2 = percent + "% " + humanReadableByteCount(dl.getCurrentSize()) + "/" + humanReadableByteCount(dl.getTotalSize());
    }
    if (dl.isComplete()) {
        right = "Completed Addon Download " + addon + " of " + dls.length;
        nextAddon();
    }
    fill(0, 0, width, height, RED.getRGB());
    fill(0, height - 20, width, height, DARK.darker().getRGB());
    fill(width - font.getStringWidth(right) - 4, height - 34, width, height, DARK.darker().getRGB());
    GlStateManager.pushMatrix();
    GlStateManager.enableBlend();
    GlStateManager.enableAlphaTest();
    minecraft.getTextureManager().bindTexture(new Identifier("sandbox", "textures/gui/sandbox.png"));
    GlStateManager.color4f(1, 1, 1, 1);
    int int_6 = (this.minecraft.getWindow().getScaledWidth() - 256) / 2;
    int int_8 = (this.minecraft.getWindow().getScaledHeight() - 256) / 2;
    this.blit(int_6, int_8, 0, 0, 256, 256);
    GlStateManager.popMatrix();
    drawCenteredString(font, "Connecting to Sandbox", (int) (width / 2f), (int) ((height / 2f) + (width / 3) / 2) - 20, WHITE.getRGB());
    drawRightText(right, width, height - 30, WHITE.getRGB());
    drawCenteredString(font, right2, width - (font.getStringWidth(right) / 2), height - 14, WHITE.getRGB());
    font.drawWithShadow("Joining Private Session", 3, height - 14, WHITE.getRGB());
}
 
Example 2
Source File: LoadingOverlay.java    From Sandbox with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public void render(int mouseX, int mouseY, float partialTicks) {
    int width = this.client.getWindow().getScaledWidth();
    int height = this.client.getWindow().getScaledHeight();
    String right = "Preparing Addon " + addon + " of " + addons.size();
    String right2 = "";
    if (dl == null) {
        nextAddon();
    }
    if (dl != null) {
        if (dl.hasStarted()) {
            right = "Downloading Addon " + addon + " of " + addons.size();
            int percent = (int) ((dl.getCurrentSize() * 100) / dl.getTotalSize());
            right2 = percent + "% " + humanReadableByteCount(dl.getCurrentSize()) + "/" + humanReadableByteCount(dl.getTotalSize());
        }
        if (dl.isComplete()) {
            right = "Completed Addon Download " + addon + " of " + addons.size();
            nextAddon();
        }
    }
    if (addon >= addons.size()) {
        client.setOverlay(null);
        SandboxClient.INSTANCE.load(addons.stream().map(addon -> Paths.get("server/cache/" + addon.getRight())).collect(Collectors.toList()));
    }
    fill(0, 0, width, height, RED.getRGB());
    fill(0, height - 20, width, height, DARK.darker().getRGB());
    fill(width - client.textRenderer.getStringWidth(right) - 4, height - 34, width, height, DARK.darker().getRGB());
    GlStateManager.pushMatrix();
    GlStateManager.enableBlend();
    GlStateManager.enableAlphaTest();
    client.getTextureManager().bindTexture(new Identifier("sandbox", "textures/gui/sandbox.png"));
    GlStateManager.color4f(1, 1, 1, 1);
    int int_6 = (this.client.getWindow().getScaledWidth() - 256) / 2;
    int int_8 = (this.client.getWindow().getScaledHeight() - 256) / 2;
    this.blit(int_6, int_8, 0, 0, 256, 256);
    GlStateManager.popMatrix();
    drawCenteredString(client.textRenderer, "Connecting to Sandbox", (int) (width / 2f), (int) ((height / 2f) + (width / 3) / 2) - 20, WHITE.getRGB());
    drawRightText(right, width, height - 30, WHITE.getRGB());
    drawCenteredString(client.textRenderer, right2, width - (client.textRenderer.getStringWidth(right) / 2), height - 14, WHITE.getRGB());
    client.textRenderer.drawWithShadow("Joining Private Session", 3, height - 14, WHITE.getRGB());
}
 
Example 3
Source File: SandboxTitleScreen.java    From Sandbox with GNU Lesser General Public License v3.0 4 votes vote down vote up
public void render(int int_1, int int_2, float float_1) {
    if (this.backgroundFadeStart == 0L && this.doBackgroundFade) {
        this.backgroundFadeStart = Util.getMeasuringTimeMs();
    }

    float float_2 = this.doBackgroundFade ? (float) (Util.getMeasuringTimeMs() - this.backgroundFadeStart) / 1000.0F : 1.0F;
    fill(0, 0, this.width, this.height, -1);
    this.backgroundRenderer.render(float_1, MathHelper.clamp(float_2, 0.0F, 1.0F));
    int int_4 = this.width / 2 - 137;
    this.minecraft.getTextureManager().bindTexture(PANORAMA_OVERLAY);
    GlStateManager.enableBlend();
    GlStateManager.blendFunc(GlStateManager.SrcFactor.SRC_ALPHA.value, GlStateManager.DstFactor.ONE_MINUS_SRC_ALPHA.value);
    GlStateManager.color4f(1.0F, 1.0F, 1.0F, this.doBackgroundFade ? (float) MathHelper.ceil(MathHelper.clamp(float_2, 0.0F, 1.0F)) : 1.0F);
    blit(0, 0, this.width, this.height, 0.0F, 0.0F, 16, 128, 16, 128);
    float float_3 = this.doBackgroundFade ? MathHelper.clamp(float_2 - 1.0F, 0.0F, 1.0F) : 1.0F;
    int int_6 = MathHelper.ceil(float_3 * 255.0F) << 24;
    if ((int_6 & -67108864) != 0) {
        this.minecraft.getTextureManager().bindTexture(MINECRAFT_TITLE_TEXTURE);
        GlStateManager.color4f(1.0F, 1.0F, 1.0F, float_3);
        if (this.field_17776) {
            this.blit(int_4 + 0, 30, 0, 0, 99, 44);
            this.blit(int_4 + 99, 30, 129, 0, 27, 44);
            this.blit(int_4 + 99 + 26, 30, 126, 0, 3, 44);
            this.blit(int_4 + 99 + 26 + 3, 30, 99, 0, 26, 44);
            this.blit(int_4 + 155, 30, 0, 45, 155, 44);
        } else {
            this.blit(int_4 + 0, 30, 0, 0, 155, 44);
            this.blit(int_4 + 155, 30, 0, 45, 155, 44);
        }

        this.minecraft.getTextureManager().bindTexture(EDITION_TITLE_TEXTURE);
        blit(int_4 + 88, 67, 0.0F, 0.0F, 98, 14, 128, 16);
        if (this.splashText != null) {
            GlStateManager.pushMatrix();
            GlStateManager.translatef((float) (this.width / 2 + 90), 70.0F, 0.0F);
            GlStateManager.rotatef(-20.0F, 0.0F, 0.0F, 1.0F);
            float float_4 = 1.8F - MathHelper.abs(MathHelper.sin((float) (Util.getMeasuringTimeMs() % 1000L) / 1000.0F * 6.2831855F) * 0.1F);
            float_4 = float_4 * 100.0F / (float) (this.font.getStringWidth(this.splashText) + 32);
            GlStateManager.scalef(float_4, float_4, float_4);
            this.drawCenteredString(this.font, this.splashText, 0, -8, 16776960 | int_6);
            GlStateManager.popMatrix();
        }

        String string_1 = "Minecraft " + SharedConstants.getGameVersion().getName();
        if (this.minecraft.isDemo()) {
            string_1 = string_1 + " Demo";
        } else {
            string_1 = string_1 + ("release".equalsIgnoreCase(this.minecraft.getVersionType()) ? "" : "/" + this.minecraft.getVersionType());
        }

        this.drawString(this.font, string_1, 2, this.height - 10, 16777215 | int_6);
        this.drawString(this.font, "Copyright Mojang AB. Do not distribute!", this.copyrightTextX, this.height - 10, 16777215 | int_6);
        if (int_1 > this.copyrightTextX && int_1 < this.copyrightTextX + this.copyrightTextWidth && int_2 > this.height - 10 && int_2 < this.height) {
            fill(this.copyrightTextX, this.height - 1, this.copyrightTextX + this.copyrightTextWidth, this.height, 16777215 | int_6);
        }

        if (this.warning != null) {
            this.warning.render(int_6);
        }

        Iterator var11 = this.buttons.iterator();

        while (var11.hasNext()) {
            AbstractButtonWidget abstractButtonWidget_1 = (AbstractButtonWidget) var11.next();
            abstractButtonWidget_1.setAlpha(float_3);
        }

        super.render(int_1, int_2, float_1);

    }
}
 
Example 4
Source File: RenderHelper.java    From BoundingBoxOutlineReloaded with MIT License 4 votes vote down vote up
public static void enableBlend() {
    GlStateManager.enableBlend();
}