diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiOilGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiOilGenerator.java index d2c5fe6e1..a22fdff20 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiOilGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiOilGenerator.java @@ -77,10 +77,10 @@ public class GuiOilGenerator extends AAScreen { drawCenteredString(matrices, this.font, this.generator.currentEnergyProduce + " " + I18n.get("actuallyadditions.fet"), this.leftPos + 87, this.topPos + 65, 0xFFFFFF); drawCenteredString(matrices, this.font, "for " + this.generator.maxBurnTime + " t", this.leftPos + 87, this.topPos + 75, 0xFFFFFF); matrices.pushPose(); - matrices.scale(0.75F, 0.75F, 1F); + matrices.translate(this.leftPos + 87, this.topPos + 85, 0); + matrices.scale(0.5625F, 0.5625F, 1F); int usage = this.generator.fuelUsage; - float xS = (this.leftPos + 87) * 1.365F - this.font.width("(per " + usage + " mB)") / 2F; - StringUtil.renderScaledAsciiString(this.font, "(per " + usage + " mB)", xS, (this.topPos + 85) * 1.345F, 0xFFFFFF, true, 0.75F); + drawCenteredString(matrices, this.font, "(per " + usage + " mB)",0, 0, 0xFFFFFF); matrices.popPose(); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/util/StringUtil.java b/src/main/java/de/ellpeck/actuallyadditions/mod/util/StringUtil.java index 4f47e1e4f..a60ad42f4 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/StringUtil.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/StringUtil.java @@ -10,6 +10,8 @@ package de.ellpeck.actuallyadditions.mod.util; +import com.mojang.blaze3d.matrix.MatrixStack; +import com.mojang.blaze3d.platform.GlStateManager; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.resources.I18n; @@ -69,16 +71,15 @@ public final class StringUtil { // } @OnlyIn(Dist.CLIENT) - public static void renderScaledAsciiString(FontRenderer font, String text, float x, float y, int color, boolean shadow, float scale) { -// GlStateManager._pushMatrix(); -// GlStateManager.scale(scale, scale, scale); -// boolean oldUnicode = font.getUnicodeFlag(); -// font.setUnicodeFlag(false); -// -// font.draw(text, x / scale, y / scale, color, shadow); -// -// font.setUnicodeFlag(oldUnicode); -// GlStateManager._popMatrix(); + public static void renderScaledString(MatrixStack matrices, FontRenderer font, String text, float x, float y, int color, boolean shadow, float scale) { + matrices.pushPose(); + matrices.translate(x, y, 0); + matrices.scale(scale, scale, 1.0F); + if (shadow) + font.drawShadow(matrices, text, 0, 0, color); + else + font.draw(matrices, text, x, y, color); + matrices.popPose(); } // static void setupLangMap() {