diff --git a/src/main/java/noppes/npcs/client/ClientEventHandler.java b/src/main/java/noppes/npcs/client/ClientEventHandler.java index 331b0de66..90c49f506 100644 --- a/src/main/java/noppes/npcs/client/ClientEventHandler.java +++ b/src/main/java/noppes/npcs/client/ClientEventHandler.java @@ -10,17 +10,9 @@ public class ClientEventHandler { @SubscribeEvent public void onOverlayRender(RenderGameOverlayEvent.Post event){ if(event.type == RenderGameOverlayEvent.ElementType.ALL) { - GL11.glEnable(GL11.GL_BLEND); - OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); - GL11.glDisable(GL11.GL_ALPHA_TEST); - for (OverlayCustom overlayCustom : Client.customOverlays.values()) { overlayCustom.renderGameOverlay(event.partialTicks); } - - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - GL11.glDisable(GL11.GL_LIGHTING); - GL11.glEnable(GL11.GL_ALPHA_TEST); } } } diff --git a/src/main/java/noppes/npcs/client/gui/custom/GuiCustom.java b/src/main/java/noppes/npcs/client/gui/custom/GuiCustom.java index 4e66719c8..f94cb1461 100644 --- a/src/main/java/noppes/npcs/client/gui/custom/GuiCustom.java +++ b/src/main/java/noppes/npcs/client/gui/custom/GuiCustom.java @@ -129,16 +129,18 @@ public class GuiCustom extends GuiScreen implements ICustomScrollListener, IGuiD Iterator var4 = this.components.values().iterator(); - GL11.glEnable(GL11.GL_BLEND); - OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); - GL11.glDisable(GL11.GL_ALPHA_TEST); while(var4.hasNext()) { + GL11.glEnable(GL11.GL_BLEND); + OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); + GL11.glDisable(GL11.GL_ALPHA_TEST); + IGuiComponent component = (IGuiComponent)var4.next(); component.onRender(this.mc, mouseX, mouseY, Mouse.getDWheel(), partialTicks); + + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glEnable(GL11.GL_ALPHA_TEST); } - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - GL11.glDisable(GL11.GL_LIGHTING); - GL11.glEnable(GL11.GL_ALPHA_TEST); if (this.hoverText != null) { this.func_146283_a(Arrays.asList(this.hoverText), mouseX, mouseY); diff --git a/src/main/java/noppes/npcs/client/gui/custom/components/CustomGuiLabel.java b/src/main/java/noppes/npcs/client/gui/custom/components/CustomGuiLabel.java index caa3a69d4..d7fde5ad7 100644 --- a/src/main/java/noppes/npcs/client/gui/custom/components/CustomGuiLabel.java +++ b/src/main/java/noppes/npcs/client/gui/custom/components/CustomGuiLabel.java @@ -45,7 +45,6 @@ public class CustomGuiLabel extends Gui implements IGuiComponent { protected int field_146161_f; public int field_146162_g; public int field_146174_h; - public boolean field_146172_j; private boolean randomStyle = false; private boolean boldStyle = false; @@ -106,7 +105,6 @@ public class CustomGuiLabel extends Gui implements IGuiComponent { CustomGuiLabel lbl = new CustomGuiLabel(component.getID(), component.getText(), GuiCustom.guiLeft + component.getPosX(), GuiCustom.guiTop + component.getPosY(), component.getWidth(), component.getHeight(), component.hasShadow()); lbl.scale = 1.0F; lbl.color = component.getColor(); - lbl.field_146172_j = true; lbl.setScale(component.getScale()); if (component.hasHoverText()) { lbl.hoverText = component.getHoverText(); @@ -129,35 +127,15 @@ public class CustomGuiLabel extends Gui implements IGuiComponent { public void drawLabel() { - if (this.field_146172_j) - { - this.drawLabelBackground(); - GL11.glPushMatrix(); - red = (color >> 16 & 255) / 255f; - green = (color >> 8 & 255) / 255f; - blue = (color & 255) / 255f; + GL11.glPushMatrix(); + red = (color >> 16 & 255) / 255f; + green = (color >> 8 & 255) / 255f; + blue = (color & 255) / 255f; - GL11.glTranslatef(this.x,this.y,0.0F); - GL11.glScalef(this.scale, this.scale, this.scale); - this.drawString(fullLabel, 0, 0, this.color, this.labelShadowEnabled); - GL11.glPopMatrix(); - } - } - - protected void drawLabelBackground() - { - if (this.labelBgEnabled) - { - int k = (int)(this.width*this.scale) + this.border * 2; - int l = (int)(this.height*this.scale) + this.border * 2; - int i1 = this.x - this.border; - int j1 = this.y - this.border; - drawRect(i1, j1, i1 + k, j1 + l, this.color);//backColor - this.drawHorizontalLine(i1, i1 + k, j1, this.color);//ulColor - this.drawHorizontalLine(i1, i1 + k, j1 + l, this.color);//brColor - this.drawVerticalLine(i1, j1, j1 + l, this.color);//ulColor - this.drawVerticalLine(i1 + k, j1, j1 + l, this.color);//brColor - } + GL11.glTranslatef(this.x,this.y,0.0F); + GL11.glScalef(this.scale, this.scale, this.scale); + this.drawString(fullLabel, 0, 0, this.color, this.labelShadowEnabled); + GL11.glPopMatrix(); } public int drawString(String p_85187_1_, int p_85187_2_, int p_85187_3_, int p_85187_4_, boolean p_85187_5_) diff --git a/src/main/java/noppes/npcs/client/gui/customoverlay/OverlayCustom.java b/src/main/java/noppes/npcs/client/gui/customoverlay/OverlayCustom.java index df6c1a1c0..dea871e62 100644 --- a/src/main/java/noppes/npcs/client/gui/customoverlay/OverlayCustom.java +++ b/src/main/java/noppes/npcs/client/gui/customoverlay/OverlayCustom.java @@ -77,8 +77,16 @@ public class OverlayCustom extends Gui { Iterator var4 = this.components.values().iterator(); while(var4.hasNext()) { + GL11.glEnable(GL11.GL_BLEND); + OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); + GL11.glDisable(GL11.GL_ALPHA_TEST); + IOverlayComponent component = (IOverlayComponent)var4.next(); component.onRender(this.mc, partialTicks); + + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glEnable(GL11.GL_ALPHA_TEST); } } diff --git a/src/main/java/noppes/npcs/client/gui/customoverlay/components/CustomOverlayLabel.java b/src/main/java/noppes/npcs/client/gui/customoverlay/components/CustomOverlayLabel.java index 52f52f195..74a47455a 100644 --- a/src/main/java/noppes/npcs/client/gui/customoverlay/components/CustomOverlayLabel.java +++ b/src/main/java/noppes/npcs/client/gui/customoverlay/components/CustomOverlayLabel.java @@ -43,7 +43,6 @@ public class CustomOverlayLabel extends Gui implements IOverlayComponent { protected int field_146161_f; public int field_146162_g; public int field_146174_h; - public boolean field_146172_j; private boolean randomStyle = false; private boolean boldStyle = false; @@ -100,7 +99,6 @@ public class CustomOverlayLabel extends Gui implements IOverlayComponent { CustomOverlayLabel lbl = new CustomOverlayLabel(component.getID(), component.getText(), component.getPosX(), component.getPosY(), component.getWidth(), component.getHeight(), component.getShadow()); lbl.scale = 1.0F; lbl.color = component.getColor(); - lbl.field_146172_j = true; lbl.setScale(component.getScale()); lbl.labelShadowEnabled = component.getShadow(); @@ -123,37 +121,17 @@ public class CustomOverlayLabel extends Gui implements IOverlayComponent { public void drawLabel() { - if (this.field_146172_j) - { - this.drawLabelBackground(); - GL11.glPushMatrix(); - GL11.glTranslatef(this.alignment%3*((float)(OverlayCustom.scaledWidth)/2), (float) (Math.floor((float)(alignment/3))*((float)(OverlayCustom.scaledHeight)/2)),0.0F);//alignment%3 * width/2 Math.floor(alignment/3) * height/2 + GL11.glPushMatrix(); + GL11.glTranslatef(this.alignment%3*((float)(OverlayCustom.scaledWidth)/2), (float) (Math.floor((float)(alignment/3))*((float)(OverlayCustom.scaledHeight)/2)),0.0F);//alignment%3 * width/2 Math.floor(alignment/3) * height/2 - red = (color >> 16 & 255) / 255f; - green = (color >> 8 & 255) / 255f; - blue = (color & 255) / 255f; + red = (color >> 16 & 255) / 255f; + green = (color >> 8 & 255) / 255f; + blue = (color & 255) / 255f; - GL11.glTranslatef(this.x,this.y,0.0F); - GL11.glScalef(this.scale, this.scale, this.scale); - this.drawString(fullLabel, 0, 0, this.color, this.labelShadowEnabled); - GL11.glPopMatrix(); - } - } - - protected void drawLabelBackground() - { - if (this.labelBgEnabled) - { - int k = (int)(this.width*this.scale) + this.border * 2; - int l = (int)(this.height*this.scale) + this.border * 2; - int i1 = this.x - this.border; - int j1 = this.y - this.border; - drawRect(i1, j1, i1 + k, j1 + l, this.color);//backColor - this.drawHorizontalLine(i1, i1 + k, j1, this.color);//ulColor - this.drawHorizontalLine(i1, i1 + k, j1 + l, this.color);//brColor - this.drawVerticalLine(i1, j1, j1 + l, this.color);//ulColor - this.drawVerticalLine(i1 + k, j1, j1 + l, this.color);//brColor - } + GL11.glTranslatef(this.x,this.y,0.0F); + GL11.glScalef(this.scale, this.scale, this.scale); + this.drawString(fullLabel, 0, 0, this.color, this.labelShadowEnabled); + GL11.glPopMatrix(); } public int drawString(String p_85187_1_, int p_85187_2_, int p_85187_3_, int p_85187_4_, boolean p_85187_5_)