Refactoring
Type-safety Minor performance improvements
This commit is contained in:
@@ -18,14 +18,15 @@
|
||||
|
||||
package appeng.client.render;
|
||||
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.core.AEConfig;
|
||||
|
||||
@@ -107,48 +108,48 @@ public class AppEngRenderItem extends RenderItem
|
||||
|
||||
if ( amount != 0 )
|
||||
{
|
||||
String var6 = "" + Math.abs( amount );
|
||||
String var6 = String.valueOf( Math.abs( amount ) );
|
||||
|
||||
if ( AEConfig.instance.useTerminalUseLargeFont() )
|
||||
{
|
||||
if ( amount > 999999999 )
|
||||
{
|
||||
var6 = "" + (int) Math.floor( amount / 1000000000.0 ) + "B";
|
||||
var6 = String.valueOf( ( int ) Math.floor( amount / 1000000000.0 ) ) + 'B';
|
||||
}
|
||||
else if ( amount > 99999999 )
|
||||
{
|
||||
var6 = "." + (int) Math.floor( amount / 100000000.0 ) + "B";
|
||||
var6 = "." + (int) Math.floor( amount / 100000000.0 ) + 'B';
|
||||
}
|
||||
else if ( amount > 999999 )
|
||||
{
|
||||
var6 = "" + (int) Math.floor( amount / 1000000.0 ) + "M";
|
||||
var6 = String.valueOf( ( int ) Math.floor( amount / 1000000.0 ) ) + 'M';
|
||||
}
|
||||
else if ( amount > 99999 )
|
||||
{
|
||||
var6 = "." + (int) Math.floor( amount / 100000.0 ) + "M";
|
||||
var6 = "." + (int) Math.floor( amount / 100000.0 ) + 'M';
|
||||
}
|
||||
else if ( amount > 999 )
|
||||
{
|
||||
var6 = "" + (int) Math.floor( amount / 1000.0 ) + "K";
|
||||
var6 = String.valueOf( ( int ) Math.floor( amount / 1000.0 ) ) + 'K';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( amount > 999999999 )
|
||||
{
|
||||
var6 = "" + (int) Math.floor( amount / 1000000000.0 ) + "B";
|
||||
var6 = String.valueOf( ( int ) Math.floor( amount / 1000000000.0 ) ) + 'B';
|
||||
}
|
||||
else if ( amount > 999999999 )
|
||||
{
|
||||
var6 = "" + (int) Math.floor( amount / 1000000000.0 ) + "B";
|
||||
var6 = String.valueOf( ( int ) Math.floor( amount / 1000000000.0 ) ) + 'B';
|
||||
}
|
||||
else if ( amount > 999999 )
|
||||
{
|
||||
var6 = "" + (int) Math.floor( amount / 1000000.0 ) + "M";
|
||||
var6 = String.valueOf( ( int ) Math.floor( amount / 1000000.0 ) ) + 'M';
|
||||
}
|
||||
else if ( amount > 9999 )
|
||||
{
|
||||
var6 = "" + (int) Math.floor( amount / 1000.0 ) + "K";
|
||||
var6 = String.valueOf( ( int ) Math.floor( amount / 1000.0 ) ) + 'K';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,9 +18,13 @@
|
||||
|
||||
package appeng.client.render;
|
||||
|
||||
|
||||
import java.nio.FloatBuffer;
|
||||
import java.util.EnumSet;
|
||||
|
||||
import org.lwjgl.BufferUtils;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
@@ -37,8 +41,8 @@ import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.client.IItemRenderer.ItemRenderType;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import org.lwjgl.BufferUtils;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import appeng.api.util.IOrientable;
|
||||
import appeng.api.util.IOrientableBlock;
|
||||
@@ -46,8 +50,6 @@ import appeng.block.AEBaseBlock;
|
||||
import appeng.client.texture.ExtraBlockTextures;
|
||||
import appeng.tile.AEBaseTile;
|
||||
import appeng.util.Platform;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class BaseBlockRender
|
||||
@@ -65,7 +67,7 @@ public class BaseBlockRender
|
||||
{
|
||||
int r = 0xff & (v >> 16);
|
||||
int g = 0xff & (v >> 8);
|
||||
int b = 0xff & (v >> 0);
|
||||
int b = 0xff & ( v );
|
||||
|
||||
r *= d;
|
||||
g *= d;
|
||||
@@ -124,8 +126,8 @@ public class BaseBlockRender
|
||||
OrientationMap[5][4][1] = 0;
|
||||
|
||||
// upside down
|
||||
OrientationMap[0][3][0] = 0 | FLIP_H_BIT;
|
||||
OrientationMap[1][3][0] = 0 | FLIP_H_BIT;
|
||||
OrientationMap[0][3][0] = FLIP_H_BIT;
|
||||
OrientationMap[1][3][0] = FLIP_H_BIT;
|
||||
OrientationMap[2][3][0] = 3;
|
||||
OrientationMap[3][3][0] = 3;
|
||||
OrientationMap[4][3][0] = 3;
|
||||
@@ -177,34 +179,34 @@ public class BaseBlockRender
|
||||
OrientationMap[0][0][5] = 1 | FLIP_H_BIT;
|
||||
OrientationMap[1][0][5] = 1;
|
||||
OrientationMap[2][0][5] = 0;
|
||||
OrientationMap[3][0][5] = 0 | FLIP_V_BIT;
|
||||
OrientationMap[3][0][5] = FLIP_V_BIT;
|
||||
OrientationMap[4][0][5] = 1;
|
||||
OrientationMap[5][0][5] = 1 | FLIP_V_BIT;
|
||||
|
||||
// side 2
|
||||
OrientationMap[0][1][2] = 0 | FLIP_H_BIT;
|
||||
OrientationMap[0][1][2] = FLIP_H_BIT;
|
||||
OrientationMap[1][1][2] = 0;
|
||||
OrientationMap[2][1][2] = 2 | FLIP_H_BIT;
|
||||
OrientationMap[3][1][2] = 1;
|
||||
OrientationMap[4][1][2] = 3;
|
||||
OrientationMap[5][1][2] = 3 | FLIP_H_BIT;
|
||||
|
||||
OrientationMap[0][4][2] = 0 | FLIP_H_BIT;
|
||||
OrientationMap[1][4][2] = 0 | FLIP_H_BIT;
|
||||
OrientationMap[0][4][2] = FLIP_H_BIT;
|
||||
OrientationMap[1][4][2] = FLIP_H_BIT;
|
||||
OrientationMap[2][4][2] = 2 | FLIP_H_BIT;
|
||||
OrientationMap[3][4][2] = 1;
|
||||
OrientationMap[4][4][2] = 1 | FLIP_H_BIT;
|
||||
OrientationMap[5][4][2] = 2;
|
||||
|
||||
OrientationMap[0][0][2] = 0 | FLIP_V_BIT;
|
||||
OrientationMap[0][0][2] = FLIP_V_BIT;
|
||||
OrientationMap[1][0][2] = 0;
|
||||
OrientationMap[2][0][2] = 2;
|
||||
OrientationMap[3][0][2] = 1 | FLIP_H_BIT;
|
||||
OrientationMap[4][0][2] = 3 | FLIP_H_BIT;
|
||||
OrientationMap[5][0][2] = 0;
|
||||
|
||||
OrientationMap[0][5][2] = 0 | FLIP_H_BIT;
|
||||
OrientationMap[1][5][2] = 0 | FLIP_H_BIT;
|
||||
OrientationMap[0][5][2] = FLIP_H_BIT;
|
||||
OrientationMap[1][5][2] = FLIP_H_BIT;
|
||||
OrientationMap[2][5][2] = 2;
|
||||
OrientationMap[3][5][2] = 1 | FLIP_H_BIT;
|
||||
OrientationMap[4][5][2] = 2;
|
||||
@@ -216,7 +218,7 @@ public class BaseBlockRender
|
||||
OrientationMap[2][0][3] = 1;
|
||||
OrientationMap[3][0][3] = 2 | FLIP_H_BIT;
|
||||
OrientationMap[4][0][3] = 0;
|
||||
OrientationMap[5][0][3] = 0 | FLIP_H_BIT;
|
||||
OrientationMap[5][0][3] = FLIP_H_BIT;
|
||||
|
||||
OrientationMap[0][4][3] = 3;
|
||||
OrientationMap[1][4][3] = 3;
|
||||
@@ -250,7 +252,7 @@ public class BaseBlockRender
|
||||
OrientationMap[0][0][4] = 1 | FLIP_H_BIT;
|
||||
OrientationMap[1][0][4] = 2;
|
||||
OrientationMap[2][0][4] = 0;
|
||||
OrientationMap[3][0][4] = 0 | FLIP_H_BIT;
|
||||
OrientationMap[3][0][4] = FLIP_H_BIT;
|
||||
OrientationMap[4][0][4] = 2 | FLIP_H_BIT;
|
||||
OrientationMap[5][0][4] = 1;
|
||||
|
||||
|
||||
@@ -18,6 +18,10 @@
|
||||
|
||||
package appeng.client.render.blocks;
|
||||
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.renderer.GLAllocation;
|
||||
@@ -27,9 +31,6 @@ import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.client.ClientHelper;
|
||||
@@ -176,11 +177,11 @@ public class RenderBlockCraftingCPUMonitor extends RenderBlockCraftingCPU
|
||||
|
||||
String msg = Long.toString( qty );
|
||||
if ( qty > 1000000000 )
|
||||
msg = Long.toString( qty / 1000000000 ) + "B";
|
||||
msg = Long.toString( qty / 1000000000 ) + 'B';
|
||||
else if ( qty > 1000000 )
|
||||
msg = Long.toString( qty / 1000000 ) + "M";
|
||||
msg = Long.toString( qty / 1000000 ) + 'M';
|
||||
else if ( qty > 9999 )
|
||||
msg = Long.toString( qty / 1000 ) + "K";
|
||||
msg = Long.toString( qty / 1000 ) + 'K';
|
||||
|
||||
FontRenderer fr = Minecraft.getMinecraft().fontRenderer;
|
||||
int width = fr.getStringWidth( msg );
|
||||
|
||||
@@ -18,14 +18,15 @@
|
||||
|
||||
package appeng.client.render.items;
|
||||
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.client.renderer.ItemRenderer;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.client.texture.ExtraItemTextures;
|
||||
import appeng.items.misc.ItemPaintBall;
|
||||
@@ -69,7 +70,7 @@ public class PaintBallRender implements IItemRenderer
|
||||
int colorValue = item.getItemDamage() >= 20 ? col.mediumVariant : col.mediumVariant;
|
||||
int r = (colorValue >> 16) & 0xff;
|
||||
int g = (colorValue >> 8) & 0xff;
|
||||
int b = (colorValue >> 0) & 0xff;
|
||||
int b = ( colorValue ) & 0xff;
|
||||
|
||||
int full = (int) (255 * 0.3);
|
||||
float fail = 0.7f;
|
||||
|
||||
Reference in New Issue
Block a user