Merge pull request #1269 from thatsIch/b-1256-number-converter

Fixes #1256: Using new size logic to determine the abbreviation for a stack size
This commit is contained in:
thatsIch
2015-04-23 23:43:31 +02:00
10 changed files with 406 additions and 390 deletions
@@ -30,12 +30,21 @@ import net.minecraft.item.ItemStack;
import appeng.api.storage.data.IAEItemStack;
import appeng.core.AEConfig;
import appeng.core.localization.GuiText;
import appeng.util.ISlimReadableNumberConverter;
import appeng.util.IWideReadableNumberConverter;
import appeng.util.ReadableNumberConverter;
/**
* @author AlgorithmX2
* @author thatsIch
* @version rv2
* @since rv0
*/
public class AppEngRenderItem extends RenderItem
{
private static final ReadableNumberConverter NUMBER_CONVERTER = ReadableNumberConverter.INSTANCE;
private static final ISlimReadableNumberConverter SLIM_CONVERTER = ReadableNumberConverter.INSTANCE;
private static final IWideReadableNumberConverter WIDE_CONVERTER = ReadableNumberConverter.INSTANCE;
public IAEItemStack aeStack;
@@ -125,11 +134,11 @@ public class AppEngRenderItem extends RenderItem
{
if( AEConfig.instance.useTerminalUseLargeFont() )
{
return NUMBER_CONVERTER.toShortHumanReadableForm( originalSize );
return SLIM_CONVERTER.toSlimReadableForm( originalSize );
}
else
{
return NUMBER_CONVERTER.toLongHumanReadableForm( originalSize );
return WIDE_CONVERTER.toWideReadableForm( originalSize );
}
}
}
@@ -37,13 +37,20 @@ import appeng.client.ClientHelper;
import appeng.core.AELog;
import appeng.tile.AEBaseTile;
import appeng.tile.crafting.TileCraftingMonitorTile;
import appeng.util.IWideReadableNumberConverter;
import appeng.util.Platform;
import appeng.util.ReadableNumberConverter;
/**
* @author AlgorithmX2
* @author thatsIch
* @version rv2
* @since rv1
*/
public class RenderBlockCraftingCPUMonitor extends RenderBlockCraftingCPU
{
private static final ReadableNumberConverter NUMBER_CONVERTER = ReadableNumberConverter.INSTANCE;
private static final IWideReadableNumberConverter NUMBER_CONVERTER = ReadableNumberConverter.INSTANCE;
public RenderBlockCraftingCPUMonitor()
{
@@ -174,7 +181,7 @@ public class RenderBlockCraftingCPUMonitor extends RenderBlockCraftingCPU
GL11.glScalef( 1.0f / 62.0f, 1.0f / 62.0f, 1.0f / 62.0f );
final long stackSize = ais.getStackSize();
final String renderedStackSize = NUMBER_CONVERTER.toHumanReadableForm( stackSize );
final String renderedStackSize = NUMBER_CONVERTER.toWideReadableForm( stackSize );
FontRenderer fr = Minecraft.getMinecraft().fontRenderer;
int width = fr.getStringWidth( renderedStackSize );