diff --git a/src/main/java/exopandora/worldhandler/config/ConfigCategorySkin.java b/src/main/java/exopandora/worldhandler/config/ConfigCategorySkin.java index f1f037b..40ae3bd 100644 --- a/src/main/java/exopandora/worldhandler/config/ConfigCategorySkin.java +++ b/src/main/java/exopandora/worldhandler/config/ConfigCategorySkin.java @@ -125,14 +125,14 @@ public class ConfigCategorySkin Config.set(this.headlineColor, color); } - private int getBackgroundRed() + public int getBackgroundRedInt() { return this.backgroundRed.get(); } - public float getBackgroundRedF() + public float getBackgroundRed() { - return this.getBackgroundRed() / 255F; + return this.getBackgroundRedInt() / 255F; } public void setBackgroundRed(int red) @@ -140,14 +140,14 @@ public class ConfigCategorySkin Config.set(this.backgroundRed, red); } - private int getBackgroundGreen() + public int getBackgroundGreenInt() { return this.backgroundGreen.get(); } - public float getBackgroundGreenF() + public float getBackgroundGreen() { - return this.getBackgroundGreen() / 255F; + return this.getBackgroundGreenInt() / 255F; } public void setBackgroundGreen(int green) @@ -155,14 +155,14 @@ public class ConfigCategorySkin Config.set(this.backgroundGreen, green); } - private int getBackgroundBlue() + public int getBackgroundBlueInt() { return this.backgroundBlue.get(); } - public float getBackgroundBlueF() + public float getBackgroundBlue() { - return this.getBackgroundBlue() / 255F; + return this.getBackgroundBlueInt() / 255F; } public void setBackgroundBlue(int blue) @@ -170,14 +170,14 @@ public class ConfigCategorySkin Config.set(this.backgroundBlue, blue); } - private int getButtonRed() + public int getButtonRedInt() { return this.buttonRed.get(); } - public float getButtonRedF() + public float getButtonRed() { - return this.getButtonRed() / 255F; + return this.getButtonRedInt() / 255F; } public void setButtonRed(int red) @@ -185,14 +185,14 @@ public class ConfigCategorySkin Config.set(this.backgroundRed, red); } - private int getButtonGreen() + public int getButtonGreenInt() { return this.buttonGreen.get(); } - public float getButtonGreenF() + public float getButtonGreen() { - return this.getButtonGreen() / 255F; + return this.getButtonGreenInt() / 255F; } public void setButtonGreen(int green) @@ -200,14 +200,14 @@ public class ConfigCategorySkin Config.set(this.buttonGreen, green); } - private int getButtonBlue() + public int getButtonBlueInt() { return this.buttonBlue.get(); } - public float getButtonBlueF() + public float getButtonBlue() { - return this.getButtonBlue() / 255F; + return this.getButtonBlueInt() / 255F; } public void setButtonBlue(int blue) @@ -245,14 +245,14 @@ public class ConfigCategorySkin Config.set(this.drawBackground, enabled); } - private int getBackgroundAlpha() + public int getBackgroundAlphaInt() { return this.backgroundAlpha.get(); } - public float getBackgroundAlphaF() + public float getBackgroundAlpha() { - return this.getBackgroundAlpha() / 255F; + return this.getBackgroundAlphaInt() / 255F; } public void setBackgroundAlpha(int alpha) @@ -260,14 +260,14 @@ public class ConfigCategorySkin Config.set(this.backgroundAlpha, alpha); } - private int getButtonAlpha() + public int getButtonAlphaInt() { return this.buttonAlpha.get(); } - public float getButtonAlphaF() + public float getButtonAlpha() { - return this.getButtonAlpha() / 255F; + return this.getButtonAlphaInt() / 255F; } public void setButtonAlpha(int alpha) diff --git a/src/main/java/exopandora/worldhandler/gui/widget/WidgetTabRenderer.java b/src/main/java/exopandora/worldhandler/gui/widget/WidgetTabRenderer.java index 3b45ac9..89838a6 100644 --- a/src/main/java/exopandora/worldhandler/gui/widget/WidgetTabRenderer.java +++ b/src/main/java/exopandora/worldhandler/gui/widget/WidgetTabRenderer.java @@ -73,7 +73,8 @@ public class WidgetTabRenderer implements IContainerWidget if(content.getActiveContent().equals(tab)) { - this.drawActiveTab(matrix, container, index, size, xPos + offset, yPos - 22, width, 25, title); + int height = Config.getSkin().getBackgroundAlphaInt() == 255 ? 25 : 22; + this.drawActiveTab(matrix, container, index, size, xPos + offset, yPos - 22, width, height, title); } else { @@ -93,24 +94,31 @@ public class WidgetTabRenderer implements IContainerWidget { RenderSystem.enableBlend(); - if(index > 0) + if(Config.getSkin().getBackgroundAlphaInt() == 255) { - RenderUtils.drawTexturedTriangleBL(matrix, container, x, y + height - 2, x - container.getBackgroundX(), 1, 2); + if(index > 0) + { + RenderUtils.drawTexturedTriangleBL(matrix, container, x, y + height - 2, x - container.getBackgroundX(), 1, 2); + } + + if(index < size - 1 || size == 1) + { + RenderUtils.drawTexturedTriangleBR(matrix, container, x + width - 2, y + height - 2, x - container.getBackgroundX() + width, 1, 2); + } + + if(index == 0) + { + RenderUtils.drawTexturedWedgeGradientTL(matrix, container, x, y + height, 0, height, width, WidgetTabRenderer.WEDGE_HEIGHT); + } + + if(index == size - 1 && size > 1) + { + RenderUtils.drawTexturedWedgeGradientTR(matrix, container, x, y + height, x - container.getBackgroundX(), height, width, WidgetTabRenderer.WEDGE_HEIGHT); + } } - - if(index < size - 1 || size == 1) + else { - RenderUtils.drawTexturedTriangleBR(matrix, container, x + width - 2, y + height - 2, x - container.getBackgroundX() + width, 1, 2); - } - - if(index == 0) - { - RenderUtils.drawTexturedWedgeGradientTL(matrix, container, x, y + height, 0, height, width, WidgetTabRenderer.WEDGE_HEIGHT); - } - - if(index == size - 1 && size > 1) - { - RenderUtils.drawTexturedWedgeGradientTR(matrix, container, x, y + height, x - container.getBackgroundX(), height, width, WidgetTabRenderer.WEDGE_HEIGHT); + this.drawTabBackgroundMerge(matrix, container, index, size, x, y, width, height); } RenderSystem.disableBlend(); @@ -127,23 +135,26 @@ public class WidgetTabRenderer implements IContainerWidget if(!Config.getSkin().sharpEdges()) { RenderSystem.enableBlend(); - - if(index == 0) - { - RenderUtils.drawTexturedTriangleTL(matrix, container, x, y + height, 0, height, 2); - } - - if(index == size - 1) - { - RenderUtils.drawTexturedTriangleTR(matrix, container, x + width - 3, y + height, container.getBackgroundWidth() - 3, height, 3); - } - + this.drawTabBackgroundMerge(matrix, container, index, size, x, y, width, height); RenderSystem.disableBlend(); } this.drawTabTitle(matrix, container, title, x + width / 2, y + 7, 0xE0E0E0); } + private void drawTabBackgroundMerge(MatrixStack matrix, Container container, int index, int size, int x, int y, int width, int height) + { + if(index == 0) + { + RenderUtils.drawTexturedTriangleTL(matrix, container, x, y + height, 0, height, 2); + } + + if(index == size - 1) + { + RenderUtils.drawTexturedTriangleTR(matrix, container, x + width - 3, y + height, container.getBackgroundWidth() - 3, height, 3); + } + } + private void drawTabBackground(MatrixStack matrix, Container container, int x, int y, int width, int height) { container.bindBackground(); diff --git a/src/main/java/exopandora/worldhandler/gui/widget/button/GuiButtonPiano.java b/src/main/java/exopandora/worldhandler/gui/widget/button/GuiButtonPiano.java index ef4e7b1..43ef23b 100644 --- a/src/main/java/exopandora/worldhandler/gui/widget/button/GuiButtonPiano.java +++ b/src/main/java/exopandora/worldhandler/gui/widget/button/GuiButtonPiano.java @@ -54,7 +54,7 @@ public class GuiButtonPiano extends GuiButtonBase } int hovered = this.getYImage(this.isHovered()); - RenderUtils.color(1.0F, 1.0F, 1.0F, Config.getSkin().getButtonAlphaF()); + RenderUtils.color(1.0F, 1.0F, 1.0F, Config.getSkin().getButtonAlpha()); Minecraft.getInstance().getTextureManager().bindTexture(NOTE); switch(this.type) diff --git a/src/main/java/exopandora/worldhandler/util/RenderUtils.java b/src/main/java/exopandora/worldhandler/util/RenderUtils.java index b295b56..a2483c8 100644 --- a/src/main/java/exopandora/worldhandler/util/RenderUtils.java +++ b/src/main/java/exopandora/worldhandler/util/RenderUtils.java @@ -53,7 +53,7 @@ public class RenderUtils matrix.pop(); - RenderUtils.color(Config.getSkin().getButtonRedF(), Config.getSkin().getButtonGreenF(), Config.getSkin().getButtonBlueF(), Config.getSkin().getButtonAlphaF()); + RenderUtils.colorDefaultButton(); Minecraft.getInstance().getTextureManager().bindTexture(ResourceHelper.iconTexture()); gui.blit(matrix, width + 0, height, 48, 0, 10, 10); @@ -155,10 +155,10 @@ public class RenderUtils public static void colorDefaultButton() { - float r = Config.getSkin().getButtonRedF(); - float g = Config.getSkin().getButtonGreenF(); - float b = Config.getSkin().getButtonBlueF(); - float a = Config.getSkin().getButtonAlphaF(); + float r = Config.getSkin().getButtonRed(); + float g = Config.getSkin().getButtonGreen(); + float b = Config.getSkin().getButtonBlue(); + float a = Config.getSkin().getButtonAlpha(); RenderUtils.color(r, g, b, a); } @@ -170,20 +170,20 @@ public class RenderUtils public static void colorDefaultBackground(double alpha) { - float r = Config.getSkin().getBackgroundRedF(); - float g = Config.getSkin().getBackgroundGreenF(); - float b = Config.getSkin().getBackgroundBlueF(); - float a = (float) alpha * Config.getSkin().getBackgroundAlphaF(); + float r = Config.getSkin().getBackgroundRed(); + float g = Config.getSkin().getBackgroundGreen(); + float b = Config.getSkin().getBackgroundBlue(); + float a = (float) alpha * Config.getSkin().getBackgroundAlpha(); RenderUtils.color(r, g, b, a); } public static void colorDarkBackground() { - float r = Config.getSkin().getBackgroundRedF(); - float g = Config.getSkin().getBackgroundGreenF(); - float b = Config.getSkin().getBackgroundBlueF(); - float a = Config.getSkin().getBackgroundAlphaF(); + float r = Config.getSkin().getBackgroundRed(); + float g = Config.getSkin().getBackgroundGreen(); + float b = Config.getSkin().getBackgroundBlue(); + float a = Config.getSkin().getBackgroundAlpha(); RenderUtils.color(Math.max(0, r - 0.3F), Math.max(0, g - 0.3F), Math.max(0, b - 0.3F), a); } @@ -243,7 +243,7 @@ public class RenderUtils for(int i = 0; i < height; i++) { double w = (height - i) / (double) (height + 1); - int z = width - (int) (w * width); + int z = (int) (w * width); RenderUtils.colorDefaultBackground(w); gui.blit(matrix, x, y + i, textureX, textureY + i, z, 1);