oωo (owo-lib)

oωo (owo-lib)

23M Downloads

[owo-ui] `ButtonComponent` method for rendering texts leads to slightly different rendering of the text

Dragon-Seeker opened this issue · 0 comments

commented

Example Alternative:

        int color = this.active ? 0xffffff : 0xa0a0a0;

        var textRenderer = MinecraftClient.getInstance().textRenderer;

        var x = this.x() + (this.width / 2f) - (textRenderer.getWidth(this.getMessage()) / 2f);
        var y = this.y() + (this.height - 8) / 2f + yTextOffset;

        if (!floatPrecision) {
            x = Math.round(x);
            y = Math.round(y);
        }

        Function5<MatrixStack, Text, Float, Float, Integer, Integer> method = this.textShadow
                ? textRenderer::drawWithShadow
                : textRenderer::draw;

        method.apply(matrices, this.getMessage(), x, y, color);