From 4aa1ba1081a452ce69fa3b184a1f7b29038be1d0 Mon Sep 17 00:00:00 2001 From: Justin Aquadro Date: Sat, 15 Aug 2015 23:00:39 -0400 Subject: [PATCH] Make gui digits readable for unicode font. --- build.gradle | 2 +- .../client/renderer/StorageRenderItem.java | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index dae56c9..15a5e26 100644 --- a/build.gradle +++ b/build.gradle @@ -17,7 +17,7 @@ buildscript { apply plugin: 'forge' -version = "1.7.10-1.5.13" +version = "1.7.10-1.5.14" group= "com.jaquadro.minecraft.storagedrawers" // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = "StorageDrawers" diff --git a/src/com/jaquadro/minecraft/storagedrawers/client/renderer/StorageRenderItem.java b/src/com/jaquadro/minecraft/storagedrawers/client/renderer/StorageRenderItem.java index 3581a67..b1508f8 100644 --- a/src/com/jaquadro/minecraft/storagedrawers/client/renderer/StorageRenderItem.java +++ b/src/com/jaquadro/minecraft/storagedrawers/client/renderer/StorageRenderItem.java @@ -22,17 +22,26 @@ public class StorageRenderItem extends RenderItem if (item != null) { float scale = .5f; + float xoff = 0; + if (font.getUnicodeFlag()) { + scale = 1f; + xoff = 1; + } if (item.stackSize > 1 || text != null) { - if (item.stackSize >= 10000) - text = (text == null) ? String.format("%.1fK", item.stackSize / 1000f) : text; + if (item.stackSize >= 100000000 || (item.stackSize >= 1000000 && font.getUnicodeFlag())) + text = (text == null) ? String.format("%.0fM", item.stackSize / 1000000f) : text; else if (item.stackSize >= 1000000) text = (text == null) ? String.format("%.1fM", item.stackSize / 1000000f) : text; + else if (item.stackSize >= 100000 || (item.stackSize >= 10000 && font.getUnicodeFlag())) + text = (text == null) ? String.format("%.0fK", item.stackSize / 1000f) : text; + else if (item.stackSize >= 10000) + text = (text == null) ? String.format("%.1fK", item.stackSize / 1000f) : text; else text = (text == null) ? String.valueOf(item.stackSize) : text; - int textX = (int)((x + 16 - font.getStringWidth(text) * scale) / scale) - 1; + int textX = (int)((x + 16 + xoff - font.getStringWidth(text) * scale) / scale) - 1; int textY = (int)((y + 16 - 7 * scale) / scale) - 1; GL11.glDisable(GL11.GL_LIGHTING);