diff options
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/features')
8 files changed, 43 insertions, 32 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/GuiFeature.java b/src/main/java/kr/syeyoung/dungeonsguide/features/GuiFeature.java index cae3dd3a..a1a8fb7a 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/GuiFeature.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/GuiFeature.java @@ -42,10 +42,8 @@ public abstract class GuiFeature extends AbstractFeature implements ScreenRender @Override public void drawScreen(float partialTicks) { if (!isEnabled()) return; + GlStateManager.pushAttrib(); GlStateManager.pushMatrix(); - GlStateManager.color(1,1,1,1); - GlStateManager.disableFog();GL11.glDisable(GL11.GL_FOG); - GlStateManager.disableLighting(); ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); Rectangle featureRect = this.featureRect.getRectangle(scaledResolution); clip(scaledResolution, featureRect.x, featureRect.y, featureRect.width, featureRect.height); @@ -56,6 +54,9 @@ public abstract class GuiFeature extends AbstractFeature implements ScreenRender GL11.glDisable(GL11.GL_SCISSOR_TEST); GlStateManager.popMatrix(); + GlStateManager.popAttrib(); + + GlStateManager.enableBlend(); } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureChestPrice.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureChestPrice.java index 349af180..5aa8fb4d 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureChestPrice.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/FeatureChestPrice.java @@ -4,6 +4,7 @@ import kr.syeyoung.dungeonsguide.e; import kr.syeyoung.dungeonsguide.features.SimpleFeature; import kr.syeyoung.dungeonsguide.features.impl.dungeon.FeatureInstaCloseChest; import kr.syeyoung.dungeonsguide.features.listener.GuiBackgroundRenderListener; +import kr.syeyoung.dungeonsguide.utils.RenderUtils; import kr.syeyoung.dungeonsguide.utils.TextUtils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; @@ -77,7 +78,7 @@ public class FeatureChestPrice extends SimpleFeature implements GuiBackgroundRen GlStateManager.pushMatrix(); GlStateManager.translate(left, top, 0); - Gui.drawRect( 0,0,width, 30, 0xFFDDDDDD); + RenderUtils.drawRectSafe( 0,0,width, 30, 0xFFDDDDDD); FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; fr.drawString("BIN/AH Price: ", 5,5, 0xFF000000); @@ -89,5 +90,8 @@ public class FeatureChestPrice extends SimpleFeature implements GuiBackgroundRen fr.drawString(str, width - fr.getStringWidth(str) - 5, 15, itemPrice > chestPrice ? 0xFF00CC00 : 0xFFCC0000); GlStateManager.popMatrix(); + + GlStateManager.enableLighting(); + GlStateManager.enableBlend(); } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/terminal/FeatureTerminalSolvers.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/terminal/FeatureTerminalSolvers.java index 07ab1106..1a686b42 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/terminal/FeatureTerminalSolvers.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/boss/terminal/FeatureTerminalSolvers.java @@ -2,6 +2,7 @@ package kr.syeyoung.dungeonsguide.features.impl.boss.terminal; import kr.syeyoung.dungeonsguide.features.SimpleFeature; import kr.syeyoung.dungeonsguide.features.listener.*; +import kr.syeyoung.dungeonsguide.utils.RenderUtils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.ScaledResolution; @@ -94,19 +95,21 @@ public class FeatureTerminalSolvers extends SimpleFeature implements GuiOpenList for (Slot currSlot : solution.getCurrSlots()) { int x = currSlot.xDisplayPosition; int y = currSlot.yDisplayPosition; - Gui.drawRect(x, y, x + 16, y + 16, 0x7700FFFF); + RenderUtils.drawRectSafe(x, y, x + 16, y + 16, 0x7700FFFF); } } if (solution.getNextSlots() != null) { for (Slot nextSlot : solution.getNextSlots()) { int x = nextSlot.xDisplayPosition; int y = nextSlot.yDisplayPosition; - Gui.drawRect(x, y, x + 16, y + 16, 0x77FFFF00); + RenderUtils.drawRectSafe(x, y, x + 16, y + 16, 0x77FFFF00); } } GlStateManager.colorMask(true, true, true, true); GlStateManager.popMatrix(); } + GlStateManager.enableBlend(); + GlStateManager.enableLighting(); } @Override diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonMap.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonMap.java index a14b9c99..2291a0e8 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonMap.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonMap.java @@ -111,11 +111,11 @@ public class FeatureDungeonMap extends GuiFeature implements DungeonEndListener, MapProcessor mapProcessor = context.getMapProcessor(); MapData mapData = mapProcessor.getLastMapData2(); Rectangle featureRect =getFeatureRect().getRectangle(); - Gui.drawRect(0,0,featureRect.width, featureRect.height, RenderUtils.getColorAt(featureRect.x, featureRect.y, this.<AColor>getParameter("background_color").getValue())); + RenderUtils.drawRectSafe(0,0,featureRect.width, featureRect.height, RenderUtils.getColorAt(featureRect.x, featureRect.y, this.<AColor>getParameter("background_color").getValue())); GlStateManager.color(1,1,1,1); GlStateManager.pushMatrix();; if (mapData == null) { - Gui.drawRect(0,0,featureRect.width, featureRect.height, 0xFFFF0000); + RenderUtils.drawRectSafe(0,0,featureRect.width, featureRect.height, 0xFFFF0000); } else { renderMap(partialTicks,mapProcessor,mapData,context); } @@ -131,7 +131,7 @@ public class FeatureDungeonMap extends GuiFeature implements DungeonEndListener, return; } Rectangle featureRect =getFeatureRect().getRectangle(); - Gui.drawRect(0,0,featureRect.width, featureRect.height, RenderUtils.getColorAt(featureRect.x, featureRect.y, this.<AColor>getParameter("background_color").getValue())); + RenderUtils.drawRectSafe(0,0,featureRect.width, featureRect.height, RenderUtils.getColorAt(featureRect.x, featureRect.y, this.<AColor>getParameter("background_color").getValue())); FontRenderer fr = getFontRenderer(); fr.drawString("Please join a dungeon to see preview", featureRect.width / 2 - fr.getStringWidth("Please join a dungeon to see preview") / 2, featureRect.height / 2 - fr.FONT_HEIGHT / 2, 0xFFFFFFFF); GL11.glLineWidth(2); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonTombs.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonTombs.java index 180df620..00785848 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonTombs.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonTombs.java @@ -56,9 +56,7 @@ public class FeatureDungeonTombs extends TextHUDFeature { @Override public java.util.List<String> getUsedTextStyle() { - return Arrays.asList(new String[] { - "title", "separator", "number" - }); + return Arrays.asList("title", "separator", "number"); } @Override diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureMechanicBrowse.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureMechanicBrowse.java index e6164fa4..c5779e2c 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureMechanicBrowse.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/secret/FeatureMechanicBrowse.java @@ -19,6 +19,7 @@ import kr.syeyoung.dungeonsguide.roomedit.gui.GuiDungeonParameterEdit; import kr.syeyoung.dungeonsguide.roomedit.gui.GuiDungeonRoomEdit; import kr.syeyoung.dungeonsguide.roomedit.gui.GuiDungeonValueEdit; import kr.syeyoung.dungeonsguide.roomprocessor.GeneralRoomProcessor; +import kr.syeyoung.dungeonsguide.utils.RenderUtils; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.gui.FontRenderer; @@ -74,8 +75,8 @@ public class FeatureMechanicBrowse extends GuiFeature implements GuiPreRenderLis Rectangle feature = getFeatureRect().getRectangle(); FontRenderer fr = getFontRenderer(); - Gui.drawRect(0, 0, feature.width, fr.FONT_HEIGHT + 4, 0xFF444444); - Gui.drawRect(1, 1, feature.width - 1, fr.FONT_HEIGHT + 3, 0xFF262626); + RenderUtils.drawRectSafe(0, 0, feature.width, fr.FONT_HEIGHT + 4, 0xFF444444); + RenderUtils.drawRectSafe(1, 1, feature.width - 1, fr.FONT_HEIGHT + 3, 0xFF262626); fr.drawString("Selected: ", 2,2, 0xFFAAAAAA); if (grp.getPath() == null) fr.drawString("Nothing", fr.getStringWidth("Selected: ") + 2,2, 0xFFAA0000); @@ -91,8 +92,8 @@ public class FeatureMechanicBrowse extends GuiFeature implements GuiPreRenderLis Rectangle feature = getFeatureRect().getRectangle(); FontRenderer fr = getFontRenderer(); - Gui.drawRect(0, 0, feature.width, fr.FONT_HEIGHT + 4, 0xFF444444); - Gui.drawRect(1, 1, feature.width - 1, fr.FONT_HEIGHT + 3, 0xFF262626); + RenderUtils.drawRectSafe(0, 0, feature.width, fr.FONT_HEIGHT + 4, 0xFF444444); + RenderUtils.drawRectSafe(1, 1, feature.width - 1, fr.FONT_HEIGHT + 3, 0xFF262626); fr.drawString("Selected: ", 2,2, 0xFFAAAAAA); fr.drawString("Nothing", fr.getStringWidth("Selected: ") + 2,2, 0xFFAA0000); fr.drawString("Open any gui to browse", 2, fr.FONT_HEIGHT + 5, 0xFFAAAAAA); @@ -131,8 +132,8 @@ public class FeatureMechanicBrowse extends GuiFeature implements GuiPreRenderLis Rectangle feature = getFeatureRect().getRectangle(); FontRenderer fr = getFontRenderer(); GlStateManager.translate(feature.x, feature.y, 0); - Gui.drawRect(0, 0, feature.width, fr.FONT_HEIGHT + 4, 0xFF444444); - Gui.drawRect(1, 1, feature.width - 1, fr.FONT_HEIGHT + 3, 0xFF262626); + RenderUtils.drawRectSafe(0, 0, feature.width, fr.FONT_HEIGHT + 4, 0xFF444444); + RenderUtils.drawRectSafe(1, 1, feature.width - 1, fr.FONT_HEIGHT + 3, 0xFF262626); fr.drawString("Selected: ", 2,2, 0xFFAAAAAA); if (grp.getPath() == null) fr.drawString("Nothing", fr.getStringWidth("Selected: ") + 2,2, 0xFFAA0000); @@ -141,8 +142,8 @@ public class FeatureMechanicBrowse extends GuiFeature implements GuiPreRenderLis fr.drawString(route.getMechanic()+" -> "+route.getState(), fr.getStringWidth("Selected: ") + 2,2, 0xFFFFFF00); } GlStateManager.translate(0, fr.FONT_HEIGHT + 4, 0); - Gui.drawRect(0, 0, feature.width, feature.height - fr.FONT_HEIGHT - 4, 0xFF444444); - Gui.drawRect(1, 1, feature.width - 1,feature.height - fr.FONT_HEIGHT - 5, 0xFF262626); + RenderUtils.drawRectSafe(0, 0, feature.width, feature.height - fr.FONT_HEIGHT - 4, 0xFF444444); + RenderUtils.drawRectSafe(1, 1, feature.width - 1,feature.height - fr.FONT_HEIGHT - 5, 0xFF262626); clip(new ScaledResolution(Minecraft.getMinecraft()), feature.x, feature.y + fr.FONT_HEIGHT + 5, feature.width , feature.height - fr.FONT_HEIGHT - 6); GL11.glEnable(GL11.GL_SCISSOR_TEST); GlStateManager.translate(0, -dy, 0); @@ -153,9 +154,9 @@ public class FeatureMechanicBrowse extends GuiFeature implements GuiPreRenderLis for (int i = 0; i < sortedMechanics.size(); i++) { Object obj = sortedMechanics.get(i); if (selected == i) { - Gui.drawRect(-1, i * fr.FONT_HEIGHT, feature.width - 3, i * fr.FONT_HEIGHT + fr.FONT_HEIGHT - 1, 0xFF444444); + RenderUtils.drawRectSafe(-1, i * fr.FONT_HEIGHT, feature.width - 3, i * fr.FONT_HEIGHT + fr.FONT_HEIGHT - 1, 0xFF444444); } else if (new Rectangle(feature.x, feature.y + fr.FONT_HEIGHT + 6 - dy + i * fr.FONT_HEIGHT, feature.width, fr.FONT_HEIGHT).contains(mouseX, mouseY)) { - Gui.drawRect(-1, i * fr.FONT_HEIGHT, feature.width - 3, i * fr.FONT_HEIGHT + fr.FONT_HEIGHT - 1, 0xFF555555); + RenderUtils.drawRectSafe(-1, i * fr.FONT_HEIGHT, feature.width - 3, i * fr.FONT_HEIGHT + fr.FONT_HEIGHT - 1, 0xFF555555); } if (obj instanceof DungeonMechanic) { String name = sortedMechanicsName.get(i); @@ -167,7 +168,7 @@ public class FeatureMechanicBrowse extends GuiFeature implements GuiPreRenderLis } else if ("$SPECIAL-CANCEL".equals(obj)) { fr.drawString("Cancel Current", 3, i * fr.FONT_HEIGHT, 0xFF00FFFF); } else { - Gui.drawRect(-1, i * fr.FONT_HEIGHT, feature.width - 3, i * fr.FONT_HEIGHT + fr.FONT_HEIGHT - 1, 0xFF444444); + RenderUtils.drawRectSafe(-1, i * fr.FONT_HEIGHT, feature.width - 3, i * fr.FONT_HEIGHT + fr.FONT_HEIGHT - 1, 0xFF444444); fr.drawString((String)obj, 3, i * fr.FONT_HEIGHT, 0xFFEEEEEE); } } @@ -176,14 +177,14 @@ public class FeatureMechanicBrowse extends GuiFeature implements GuiPreRenderLis if (selected != -1) { clip(new ScaledResolution(Minecraft.getMinecraft()), feature.x + feature.width, feature.y + fr.FONT_HEIGHT + 5, feature.width , feature.height - fr.FONT_HEIGHT - 6); GlStateManager.translate(feature.width, selected * fr.FONT_HEIGHT, 0); - Gui.drawRect(0, 0, feature.width, fr.FONT_HEIGHT * possibleStates.size() + 4, 0xFF444444); - Gui.drawRect(-1, 1, feature.width - 1, fr.FONT_HEIGHT * possibleStates.size() + 3, 0xFF262626); + RenderUtils.drawRectSafe(0, 0, feature.width, fr.FONT_HEIGHT * possibleStates.size() + 4, 0xFF444444); + RenderUtils.drawRectSafe(-1, 1, feature.width - 1, fr.FONT_HEIGHT * possibleStates.size() + 3, 0xFF262626); GlStateManager.translate(2,2, 0); Point popupStart = new Point(feature.x + feature.width, (selected + 1) * fr.FONT_HEIGHT +6 + feature.y - dy + 2); for (int i = 0; i < possibleStates.size(); i++) { if (new Rectangle(feature.x + feature.width, popupStart.y + i * fr.FONT_HEIGHT, feature.width, fr.FONT_HEIGHT).contains(mouseX, mouseY)) { - Gui.drawRect(-2, i * fr.FONT_HEIGHT, feature.width - 3, i * fr.FONT_HEIGHT + fr.FONT_HEIGHT - 1, 0xFF555555); + RenderUtils.drawRectSafe(-2, i * fr.FONT_HEIGHT, feature.width - 3, i * fr.FONT_HEIGHT + fr.FONT_HEIGHT - 1, 0xFF555555); } fr.drawString(possibleStates.get(i), 0, i * fr.FONT_HEIGHT, 0xFFFFFFFF); } @@ -191,6 +192,7 @@ public class FeatureMechanicBrowse extends GuiFeature implements GuiPreRenderLis GL11.glDisable(GL11.GL_SCISSOR_TEST); GlStateManager.popMatrix(); + GlStateManager.enableBlend(); } private void clip(ScaledResolution resolution, int x, int y, int width, int height) { diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/text/PanelTextParameterConfig.java b/src/main/java/kr/syeyoung/dungeonsguide/features/text/PanelTextParameterConfig.java index adc4ca6d..c1b182d7 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/text/PanelTextParameterConfig.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/text/PanelTextParameterConfig.java @@ -14,6 +14,7 @@ import kr.syeyoung.dungeonsguide.gui.elements.MButton; import kr.syeyoung.dungeonsguide.gui.elements.MColor; import kr.syeyoung.dungeonsguide.gui.elements.MEditableAColor; import kr.syeyoung.dungeonsguide.gui.elements.MToggleButton; +import kr.syeyoung.dungeonsguide.utils.RenderUtils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.Gui; @@ -102,9 +103,9 @@ public class PanelTextParameterConfig extends MPanel { GlStateManager.pushMatrix(); int width = 200, height = 100; - Gui.drawRect(0,0,getBounds().width, getBounds().height, 0xFF444444); - Gui.drawRect(4,4,width+6, height+6, 0xFF222222); - Gui.drawRect(5,5,width+5, height+5, 0xFF555555); + RenderUtils.drawRectSafe(0,0,getBounds().width, getBounds().height, 0xFF444444); + RenderUtils.drawRectSafe(4,4,width+6, height+6, 0xFF222222); + RenderUtils.drawRectSafe(5,5,width+5, height+5, 0xFF555555); Rectangle clip = new Rectangle(scissor.x + 5, scissor.y + 5, width, height); clip(new ScaledResolution(Minecraft.getMinecraft()), clip.x, clip.y, clip.width, clip.height); @@ -119,11 +120,11 @@ public class PanelTextParameterConfig extends MPanel { boolean bool =clip.contains(absMousex, absMousey); for (StyledTextRenderer.StyleTextAssociated calc3: calc) { if (selected.contains(calc3.getStyledText().getGroup())) { - Gui.drawRect(calc3.getRectangle().x, calc3.getRectangle().y, calc3.getRectangle().x + calc3.getRectangle().width, calc3.getRectangle().y + calc3.getRectangle().height, 0x4244A800); + RenderUtils.drawRectSafe(calc3.getRectangle().x, calc3.getRectangle().y, calc3.getRectangle().x + calc3.getRectangle().width, calc3.getRectangle().y + calc3.getRectangle().height, 0x4244A800); } else if (bool && calc3.getRectangle().contains((relMousex0-5 -offsetX) * scale , (relMousey0 - 5 - offsetY) * scale)) { for (StyledTextRenderer.StyleTextAssociated calc2 : calc) { if (calc2.getStyledText().getGroup().equals(calc3.getStyledText().getGroup())) - Gui.drawRect(calc2.getRectangle().x, calc2.getRectangle().y, calc2.getRectangle().x + calc2.getRectangle().width, calc2.getRectangle().y + calc2.getRectangle().height, 0x55777777); + RenderUtils.drawRectSafe(calc2.getRectangle().x, calc2.getRectangle().y, calc2.getRectangle().x + calc2.getRectangle().width, calc2.getRectangle().y + calc2.getRectangle().height, 0x55777777); } } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/text/StyledTextRenderer.java b/src/main/java/kr/syeyoung/dungeonsguide/features/text/StyledTextRenderer.java index b20b2f33..d6fd8ab4 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/text/StyledTextRenderer.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/text/StyledTextRenderer.java @@ -6,6 +6,7 @@ import lombok.Data; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.Gui; +import net.minecraft.client.renderer.GlStateManager; import java.awt.*; import java.util.ArrayList; @@ -88,8 +89,9 @@ public class StyledTextRenderer { if (stopDraw) return new Dimension(fr.getStringWidth(content), fr.FONT_HEIGHT); - Gui.drawRect(x,y, x+fr.getStringWidth(content), y + fr.FONT_HEIGHT, RenderUtils.getColorAt(x,y, style.getBackground())); + RenderUtils.drawRectSafe(x,y, x+fr.getStringWidth(content), y + fr.FONT_HEIGHT, RenderUtils.getColorAt(x,y, style.getBackground())); + GlStateManager.enableBlend(); if (!style.getColor().isChroma()) { fr.drawString(content, x, y, style.getColor().getRGB(), style.isShadow()); return new Dimension(fr.getStringWidth(content), fr.FONT_HEIGHT); |