From 07a98270c3966bbbdc9b323dd215ba964da9d97d Mon Sep 17 00:00:00 2001 From: AlgorithmX2 Date: Thu, 24 Apr 2014 02:13:33 -0500 Subject: [PATCH 1/4] Fixed #0356 - Scrollbar is locked after right click searchbox --- client/gui/implementations/GuiMEMonitorable.java | 1 + 1 file changed, 1 insertion(+) diff --git a/client/gui/implementations/GuiMEMonitorable.java b/client/gui/implementations/GuiMEMonitorable.java index e3e7b06ee..a3214b74e 100644 --- a/client/gui/implementations/GuiMEMonitorable.java +++ b/client/gui/implementations/GuiMEMonitorable.java @@ -265,6 +265,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi searchField.setText( "" ); repo.searchString = ""; repo.updateView(); + setScrollBar(); } super.mouseClicked( xCoord, yCoord, btn ); From 27b9d0f4cd4a18890372f0b475d4eeee58bd331f Mon Sep 17 00:00:00 2001 From: AlgorithmX2 Date: Thu, 24 Apr 2014 02:13:52 -0500 Subject: [PATCH 2/4] Energy FX is now much more light weight. --- client/render/effects/EnergyFx.java | 32 ++++++++++++++--------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/client/render/effects/EnergyFx.java b/client/render/effects/EnergyFx.java index 393a11627..e13c47905 100644 --- a/client/render/effects/EnergyFx.java +++ b/client/render/effects/EnergyFx.java @@ -1,17 +1,12 @@ package appeng.client.render.effects; -import net.minecraft.client.Minecraft; import net.minecraft.client.particle.EntityBreakingFX; import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.item.Item; import net.minecraft.util.IIcon; import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; - -import org.lwjgl.opengl.GL11; - import appeng.client.texture.ExtraTextures; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -26,6 +21,11 @@ public class EnergyFx extends EntityBreakingFX private int startBlkY; private int startBlkZ; + public int getFXLayer() + { + return 1; + } + public EnergyFx(World par1World, double par2, double par4, double par6, Item par8Item) { super( par1World, par2, par4, par6, par8Item ); particleGravity = 0; @@ -58,16 +58,14 @@ public class EnergyFx extends EntityBreakingFX public void renderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7) { - Minecraft.getMinecraft().getTextureManager().bindTexture( TextureMap.locationBlocksTexture ); - - GL11.glPushMatrix(); - GL11.glPushAttrib( GL11.GL_ALL_ATTRIB_BITS ); - GL11.glColor4f( 1.0F, 1.0F, 1.0F, 1.0F ); - - GL11.glDepthMask( false ); - GL11.glEnable( GL11.GL_BLEND ); - GL11.glBlendFunc( GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA ); - GL11.glAlphaFunc( GL11.GL_GREATER, 0.003921569F ); + /* + * Minecraft.getMinecraft().getTextureManager().bindTexture( TextureMap.locationBlocksTexture ); + * + * GL11.glPushMatrix(); GL11.glPushAttrib( GL11.GL_ALL_ATTRIB_BITS ); GL11.glColor4f( 1.0F, 1.0F, 1.0F, 1.0F ); + * + * GL11.glDepthMask( false ); GL11.glEnable( GL11.GL_BLEND ); GL11.glBlendFunc( GL11.GL_SRC_ALPHA, + * GL11.GL_ONE_MINUS_SRC_ALPHA ); GL11.glAlphaFunc( GL11.GL_GREATER, 0.003921569F ); + */ float f6 = this.particleTextureIndex.getMinU(); float f7 = this.particleTextureIndex.getMaxU(); @@ -97,8 +95,8 @@ public class EnergyFx extends EntityBreakingFX (double) f6, (double) f9 ); } - GL11.glPopAttrib(); - GL11.glPopMatrix(); + // GL11.glPopAttrib(); + // GL11.glPopMatrix(); } } From fafa79e657bc3751915fc0d8400459e66bf97745 Mon Sep 17 00:00:00 2001 From: AlgorithmX2 Date: Thu, 24 Apr 2014 02:14:07 -0500 Subject: [PATCH 3/4] Monitors now use render caching. --- parts/reporting/PartMonitor.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/parts/reporting/PartMonitor.java b/parts/reporting/PartMonitor.java index be6b850d3..8dea75c5b 100644 --- a/parts/reporting/PartMonitor.java +++ b/parts/reporting/PartMonitor.java @@ -151,6 +151,8 @@ public class PartMonitor extends AEBasePart implements IPartMonitor, IPowerChann @SideOnly(Side.CLIENT) public void renderStatic(int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer) { + renderCache = rh.useSimpliedRendering( x, y, z, this, renderCache ); + rh.setTexture( CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), is.getIconIndex(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon() ); From 722d065c2cb79ce27e6b6f2b2247f63009482005 Mon Sep 17 00:00:00 2001 From: AlgorithmX2 Date: Thu, 24 Apr 2014 02:14:18 -0500 Subject: [PATCH 4/4] Storage monitors now use display lists. --- parts/reporting/PartStorageMonitor.java | 212 ++++++++++++++---------- 1 file changed, 124 insertions(+), 88 deletions(-) diff --git a/parts/reporting/PartStorageMonitor.java b/parts/reporting/PartStorageMonitor.java index 7d8899dc1..ce9fb3678 100644 --- a/parts/reporting/PartStorageMonitor.java +++ b/parts/reporting/PartStorageMonitor.java @@ -6,6 +6,7 @@ import java.io.IOException; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.renderer.GLAllocation; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.Tessellator; @@ -112,6 +113,8 @@ public class PartStorageMonitor extends PartMonitor implements IPartStorageMonit else configuredItem = null; + updateList = true; + return stuff; } @@ -150,11 +153,11 @@ public class PartStorageMonitor extends PartMonitor implements IPartStorageMonit } protected PartStorageMonitor(Class myClass, ItemStack is) { - super( myClass, is,true ); + super( myClass, is, true ); } public PartStorageMonitor(ItemStack is) { - super( PartStorageMonitor.class, is,true ); + super( PartStorageMonitor.class, is, true ); frontBright = CableBusTextures.PartStorageMonitor_Bright; frontColored = CableBusTextures.PartStorageMonitor_Colored; frontDark = CableBusTextures.PartStorageMonitor_Dark; @@ -167,10 +170,28 @@ public class PartStorageMonitor extends PartMonitor implements IPartStorageMonit return true; } + @SideOnly(Side.CLIENT) + private boolean updateList; + + @SideOnly(Side.CLIENT) + private Integer dspList; + + @Override + @SideOnly(Side.CLIENT) + protected void finalize() throws Throwable + { + super.finalize(); + if ( dspList != null ) + GLAllocation.deleteDisplayLists( dspList ); + } + @Override @SideOnly(Side.CLIENT) public void renderDynamic(double x, double y, double z, IPartRenderHelper rh, RenderBlocks renderer) { + if ( dspList == null ) + dspList = GLAllocation.generateDisplayLists( 1 ); + Tessellator tess = Tessellator.instance; if ( Platform.isDrawing( tess ) ) return; @@ -182,101 +203,116 @@ public class PartStorageMonitor extends PartMonitor implements IPartStorageMonit if ( ais != null ) { GL11.glPushMatrix(); - GL11.glPushAttrib( GL11.GL_ALL_ATTRIB_BITS ); - ForgeDirection d = side; GL11.glTranslated( x + 0.5, y + 0.5, z + 0.5 ); - GL11.glTranslated( d.offsetX * 0.76, d.offsetY * 0.76, d.offsetZ * 0.76 ); - if ( d == ForgeDirection.UP ) + if ( updateList ) { - GL11.glScalef( 1.0f, -1.0f, 1.0f ); - GL11.glRotatef( 90.0f, 1.0f, 0.0f, 0.0f ); - GL11.glRotatef( (float) spin * 90.0F, 0, 0, 1 ); + updateList = false; + GL11.glNewList( dspList, GL11.GL_COMPILE_AND_EXECUTE ); + tesrRenderScreen( tess, ais ); + GL11.glEndList(); } + else + GL11.glCallList( dspList ); - if ( d == ForgeDirection.DOWN ) - { - GL11.glScalef( 1.0f, -1.0f, 1.0f ); - GL11.glRotatef( -90.0f, 1.0f, 0.0f, 0.0f ); - GL11.glRotatef( (float) spin * -90.0F, 0, 0, 1 ); - } - - if ( d == ForgeDirection.EAST ) - { - GL11.glScalef( -1.0f, -1.0f, -1.0f ); - GL11.glRotatef( -90.0f, 0.0f, 1.0f, 0.0f ); - } - - if ( d == ForgeDirection.WEST ) - { - GL11.glScalef( -1.0f, -1.0f, -1.0f ); - GL11.glRotatef( 90.0f, 0.0f, 1.0f, 0.0f ); - } - - if ( d == ForgeDirection.NORTH ) - { - GL11.glScalef( -1.0f, -1.0f, -1.0f ); - } - - if ( d == ForgeDirection.SOUTH ) - { - GL11.glScalef( -1.0f, -1.0f, -1.0f ); - GL11.glRotatef( 180.0f, 0.0f, 1.0f, 0.0f ); - } - - GL11.glPushMatrix(); - try - { - ItemStack sis = ais.getItemStack(); - sis.stackSize = 1; - - int br = 16 << 20 | 16 << 4; - int var11 = br % 65536; - int var12 = br / 65536; - OpenGlHelper.setLightmapTextureCoords( OpenGlHelper.lightmapTexUnit, var11 * 0.8F, var12 * 0.8F ); - - GL11.glColor4f( 1.0F, 1.0F, 1.0F, 1.0F ); - - GL11.glDisable( GL11.GL_LIGHTING ); - GL11.glDisable( GL12.GL_RESCALE_NORMAL ); - // RenderHelper.enableGUIStandardItemLighting(); - tess.setColorOpaque_F( 1.0f, 1.0f, 1.0f ); - - ClientHelper.proxy.doRenderItem( sis, this.tile ); - - } - catch (Exception e) - { - AELog.error( e ); - } - - GL11.glPopMatrix(); - - GL11.glTranslatef( 0.0f, 0.14f, -0.24f ); - GL11.glScalef( 1.0f / 62.0f, 1.0f / 62.0f, 1.0f / 62.0f ); - - long qty = ais.getStackSize(); - if ( qty > 999999999999L ) - qty = 999999999999L; - - String msg = Long.toString( qty ); - if ( qty > 1000000000 ) - msg = Long.toString( qty / 1000000000 ) + "B"; - else if ( qty > 1000000 ) - msg = Long.toString( qty / 1000000 ) + "M"; - else if ( qty > 9999 ) - msg = Long.toString( qty / 1000 ) + "K"; - - FontRenderer fr = Minecraft.getMinecraft().fontRenderer; - int width = fr.getStringWidth( msg ); - GL11.glTranslatef( -0.5f * width, 0.0f, -1.0f ); - fr.drawString( msg, 0, 0, 0 ); - - GL11.glPopAttrib(); GL11.glPopMatrix(); } } + private void tesrRenderScreen(Tessellator tess, IAEItemStack ais) + { + GL11.glPushAttrib( GL11.GL_ALL_ATTRIB_BITS ); + ForgeDirection d = side; + GL11.glTranslated( d.offsetX * 0.76, d.offsetY * 0.76, d.offsetZ * 0.76 ); + + if ( d == ForgeDirection.UP ) + { + GL11.glScalef( 1.0f, -1.0f, 1.0f ); + GL11.glRotatef( 90.0f, 1.0f, 0.0f, 0.0f ); + GL11.glRotatef( (float) spin * 90.0F, 0, 0, 1 ); + } + + if ( d == ForgeDirection.DOWN ) + { + GL11.glScalef( 1.0f, -1.0f, 1.0f ); + GL11.glRotatef( -90.0f, 1.0f, 0.0f, 0.0f ); + GL11.glRotatef( (float) spin * -90.0F, 0, 0, 1 ); + } + + if ( d == ForgeDirection.EAST ) + { + GL11.glScalef( -1.0f, -1.0f, -1.0f ); + GL11.glRotatef( -90.0f, 0.0f, 1.0f, 0.0f ); + } + + if ( d == ForgeDirection.WEST ) + { + GL11.glScalef( -1.0f, -1.0f, -1.0f ); + GL11.glRotatef( 90.0f, 0.0f, 1.0f, 0.0f ); + } + + if ( d == ForgeDirection.NORTH ) + { + GL11.glScalef( -1.0f, -1.0f, -1.0f ); + } + + if ( d == ForgeDirection.SOUTH ) + { + GL11.glScalef( -1.0f, -1.0f, -1.0f ); + GL11.glRotatef( 180.0f, 0.0f, 1.0f, 0.0f ); + } + + GL11.glPushMatrix(); + try + { + ItemStack sis = ais.getItemStack(); + sis.stackSize = 1; + + int br = 16 << 20 | 16 << 4; + int var11 = br % 65536; + int var12 = br / 65536; + OpenGlHelper.setLightmapTextureCoords( OpenGlHelper.lightmapTexUnit, var11 * 0.8F, var12 * 0.8F ); + + GL11.glColor4f( 1.0F, 1.0F, 1.0F, 1.0F ); + + GL11.glDisable( GL11.GL_LIGHTING ); + GL11.glDisable( GL12.GL_RESCALE_NORMAL ); + // RenderHelper.enableGUIStandardItemLighting(); + tess.setColorOpaque_F( 1.0f, 1.0f, 1.0f ); + + ClientHelper.proxy.doRenderItem( sis, this.tile ); + + } + catch (Exception e) + { + AELog.error( e ); + } + + GL11.glPopMatrix(); + + GL11.glTranslatef( 0.0f, 0.14f, -0.24f ); + GL11.glScalef( 1.0f / 62.0f, 1.0f / 62.0f, 1.0f / 62.0f ); + + long qty = ais.getStackSize(); + if ( qty > 999999999999L ) + qty = 999999999999L; + + String msg = Long.toString( qty ); + if ( qty > 1000000000 ) + msg = Long.toString( qty / 1000000000 ) + "B"; + else if ( qty > 1000000 ) + msg = Long.toString( qty / 1000000 ) + "M"; + else if ( qty > 9999 ) + msg = Long.toString( qty / 1000 ) + "K"; + + FontRenderer fr = Minecraft.getMinecraft().fontRenderer; + int width = fr.getStringWidth( msg ); + GL11.glTranslatef( -0.5f * width, 0.0f, -1.0f ); + fr.drawString( msg, 0, 0, 0 ); + + GL11.glPopAttrib(); + } + @Override public IAEStack getDisplayed() {