Search in sources :

Example 1 with BedrockifySettings

use of me.juancarloscp52.bedrockify.BedrockifySettings in project BedrockIfy by juancarloscp52.

the class Overlay method renderPositionText.

private void renderPositionText(MatrixStack matrixStack) {
    BedrockifySettings settings = Bedrockify.getInstance().settings;
    int screenBorder = settings.getScreenSafeArea();
    int posY = settings.getPositionHUDHeight();
    if (!settings.isShowPositionHUDEnabled())
        return;
    BlockPos blockPos = Objects.requireNonNull(this.client.getCameraEntity(), "Camera Entity cannot be null.").getBlockPos();
    MutableText position = new TranslatableText("bedrockify.hud.position").append(new LiteralText(" " + blockPos.getX() + ", " + blockPos.getY() + ", " + blockPos.getZ()));
    if (settings.getFPSHUDoption() == 1)
        position.append(" ").append(fps);
    int positionWidth = client.textRenderer.getWidth(position);
    fill(matrixStack, textPosX + screenBorder, posY + screenBorder, textPosX + positionWidth + 6 + screenBorder, posY + 10 + screenBorder, MathHelper.ceil((255.0D * client.options.textBackgroundOpacity)) << 24);
    client.textRenderer.drawWithShadow(matrixStack, position, textPosX + 3 + screenBorder, posY + 1 + screenBorder, 16777215);
}
Also used : MutableText(net.minecraft.text.MutableText) TranslatableText(net.minecraft.text.TranslatableText) BedrockifySettings(me.juancarloscp52.bedrockify.BedrockifySettings) BlockPos(net.minecraft.util.math.BlockPos) LiteralText(net.minecraft.text.LiteralText)

Example 2 with BedrockifySettings

use of me.juancarloscp52.bedrockify.BedrockifySettings in project BedrockIfy by juancarloscp52.

the class Overlay method renderFpsText.

private void renderFpsText(MatrixStack matrixStack) {
    BedrockifySettings settings = Bedrockify.getInstance().settings;
    int screenBorder = settings.getScreenSafeArea();
    int posY = settings.getPositionHUDHeight();
    boolean positionEnabled = settings.isShowPositionHUDEnabled();
    if (settings.getFPSHUDoption() != 2)
        return;
    int fpsCounterWidth = client.textRenderer.getWidth(fps);
    fill(matrixStack, textPosX + screenBorder, posY + (positionEnabled ? 10 : 0) + screenBorder, textPosX + fpsCounterWidth + 6 + screenBorder, posY + (positionEnabled ? 10 : 0) + 10 + screenBorder, MathHelper.ceil((255.0D * client.options.textBackgroundOpacity)) << 24);
    client.textRenderer.drawWithShadow(matrixStack, fps, textPosX + 3 + screenBorder, posY + 1 + (positionEnabled ? 10 : 0) + screenBorder, 16777215);
}
Also used : BedrockifySettings(me.juancarloscp52.bedrockify.BedrockifySettings)

Example 3 with BedrockifySettings

use of me.juancarloscp52.bedrockify.BedrockifySettings in project BedrockIfy by juancarloscp52.

the class SavingOverlay method render.

public void render(MatrixStack matrixStack) {
    final BedrockifySettings settings = Bedrockify.getInstance().settings;
    if (saving || System.currentTimeMillis() - timer < 3000) {
        client.getTextureManager().bindTexture(WIDGET_TEXTURE);
        // Draw chest
        this.drawTexture(matrixStack, client.getWindow().getScaledWidth() - (21 + settings.getScreenSafeArea()), 19 + settings.getScreenSafeArea(), 0, 99, 16, 17);
        // Draw arrow
        this.drawTexture(matrixStack, client.getWindow().getScaledWidth() - (19 + settings.getScreenSafeArea()), 5 + settings.getScreenSafeArea() + MathHelper.fastFloor(MathHelper.abs(MathHelper.sin((float) (Util.getMeasuringTimeMs() % 1000L) / 1000F * 3.1415926F) * 6)), 16, 99, 12, 15);
    }
}
Also used : BedrockifySettings(me.juancarloscp52.bedrockify.BedrockifySettings)

Example 4 with BedrockifySettings

use of me.juancarloscp52.bedrockify.BedrockifySettings in project BedrockIfy by juancarloscp52.

the class ChatHudMixin method getAvailableLines.

private int getAvailableLines() {
    BedrockifySettings settings = Bedrockify.getInstance().settings;
    int posY = settings.getPositionHUDHeight() + (settings.isShowPositionHUDEnabled() ? 10 : 0) + (settings.getFPSHUDoption() == 2 ? 10 : 0) + settings.getScreenSafeArea();
    return MathHelper.ceil((client.getWindow().getScaledHeight() - posY) / ((this.client.options.chatLineSpacing + 1.0D) * 9)) - 2;
}
Also used : BedrockifySettings(me.juancarloscp52.bedrockify.BedrockifySettings)

Example 5 with BedrockifySettings

use of me.juancarloscp52.bedrockify.BedrockifySettings in project BedrockIfy by juancarloscp52.

the class HeldItemTooltips method drawItemWithCustomTooltips.

public int drawItemWithCustomTooltips(TextRenderer fontRenderer, MatrixStack matrices, Text text, float x, float y, int color, ItemStack currentStack) {
    int screenBorder = Bedrockify.getInstance().settings.getScreenSafeArea();
    // Get the current held item tooltips.
    List<Tooltip> tooltips = getTooltips(currentStack);
    int tooltipOffset = 0;
    BedrockifySettings settings = Bedrockify.getInstance().settings;
    // Draw item tooltips if the option is enabled.
    if (settings.getHeldItemTooltip() > 0) {
        if (tooltips != null) {
            // Compute the max tooltip offset (used for the item name).
            int count = 0;
            // Limit the maximum number of shown tooltips to 4.
            boolean showMoreTooltip = false;
            if (tooltips.size() > 4) {
                showMoreTooltip = true;
                tooltipOffset = 12 * 4;
                count++;
            } else
                tooltipOffset = tooltips.size() * 12;
            // Render background behind tooltip if enabled.
            if (settings.getHeldItemTooltip() == 2) {
                int maxLength = getMaxTooltipLength(tooltips, fontRenderer, currentStack);
                renderBackground(matrices, y, screenBorder, tooltipOffset, maxLength);
            }
            for (Tooltip elem : tooltips) {
                // Prevent from drawing more than 4 tooltips.
                if (count > 3)
                    break;
                // Render the tooltip.
                renderTooltip(fontRenderer, matrices, y - screenBorder - (12 * count), color, elem.getTooltipText().formatted(Formatting.GRAY));
                count++;
            }
            // show the "and x more..." tooltip if the item has more than 4 tooltips.
            if (showMoreTooltip)
                renderTooltip(fontRenderer, matrices, y - screenBorder, color, new TranslatableText("container.shulkerBox.more", tooltips.size() - 4).formatted(Formatting.GRAY));
        } else if (settings.getHeldItemTooltip() == 2) {
            // draw the background
            renderBackground(matrices, y, screenBorder, tooltipOffset, fontRenderer.getWidth(text));
        }
    }
    // Render the item name.
    return fontRenderer.drawWithShadow(matrices, text, x, y - tooltipOffset - screenBorder, color);
}
Also used : TranslatableText(net.minecraft.text.TranslatableText) BedrockifySettings(me.juancarloscp52.bedrockify.BedrockifySettings) PotionTooltip(me.juancarloscp52.bedrockify.client.features.HeldItemTooltips.Tooltip.PotionTooltip) EnchantmentTooltip(me.juancarloscp52.bedrockify.client.features.HeldItemTooltips.Tooltip.EnchantmentTooltip) Tooltip(me.juancarloscp52.bedrockify.client.features.HeldItemTooltips.Tooltip.Tooltip) ShulkerBoxTooltip(me.juancarloscp52.bedrockify.client.features.HeldItemTooltips.Tooltip.ShulkerBoxTooltip)

Aggregations

BedrockifySettings (me.juancarloscp52.bedrockify.BedrockifySettings)5 TranslatableText (net.minecraft.text.TranslatableText)2 EnchantmentTooltip (me.juancarloscp52.bedrockify.client.features.HeldItemTooltips.Tooltip.EnchantmentTooltip)1 PotionTooltip (me.juancarloscp52.bedrockify.client.features.HeldItemTooltips.Tooltip.PotionTooltip)1 ShulkerBoxTooltip (me.juancarloscp52.bedrockify.client.features.HeldItemTooltips.Tooltip.ShulkerBoxTooltip)1 Tooltip (me.juancarloscp52.bedrockify.client.features.HeldItemTooltips.Tooltip.Tooltip)1 LiteralText (net.minecraft.text.LiteralText)1 MutableText (net.minecraft.text.MutableText)1 BlockPos (net.minecraft.util.math.BlockPos)1