diff options
author | syeyoung <cyong06@naver.com> | 2021-03-10 23:06:05 +0900 |
---|---|---|
committer | syeyoung <cyong06@naver.com> | 2021-03-10 23:06:05 +0900 |
commit | 92ce9024b73df31f3c88ad23a7443dec2578469c (patch) | |
tree | dd7f6c928c79e2847a34ccb47820a037d244e361 | |
parent | a7030786cc5f3b756f8b538f8f071cd7d5c14e77 (diff) | |
download | Skyblock-Dungeons-Guide-92ce9024b73df31f3c88ad23a7443dec2578469c.tar.gz Skyblock-Dungeons-Guide-92ce9024b73df31f3c88ad23a7443dec2578469c.tar.bz2 Skyblock-Dungeons-Guide-92ce9024b73df31f3c88ad23a7443dec2578469c.zip |
finally fix gui flashing issue.
38 files changed, 225 insertions, 122 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiConfig.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiConfig.java index 27b71e06..406046d9 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiConfig.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiConfig.java @@ -79,11 +79,13 @@ public class GuiConfig extends GuiScreen { GlStateManager.color(1, 1, 1, 1); GlStateManager.disableDepth(); GlStateManager.depthMask(false); - mainPanel.render0(scaledResolution, new Point(0, 0), new Rectangle(0, 0, scaledResolution.getScaledWidth(), scaledResolution.getScaledHeight()), mouseX, mouseY, mouseX, mouseY, partialTicks); + mainPanel.render0(scaledResolution, new Point(0,0), new Rectangle(0,0,scaledResolution.getScaledWidth(),scaledResolution.getScaledHeight()), mouseX, mouseY, mouseX, mouseY, partialTicks); GlStateManager.enableDepth(); GlStateManager.depthMask(true); GlStateManager.popAttrib(); GlStateManager.popMatrix(); + GlStateManager.enableBlend(); + GlStateManager.enableLighting(); } catch (Throwable e) { e.printStackTrace(); } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiGuiLocationConfig.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiGuiLocationConfig.java index 646cd0e5..93ae3a22 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiGuiLocationConfig.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiGuiLocationConfig.java @@ -56,12 +56,14 @@ public class GuiGuiLocationConfig extends GuiScreen { @Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { + ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); GlStateManager.pushMatrix(); GlStateManager.pushAttrib(); GlStateManager.disableLighting(); - GlStateManager.disableFog();GL11.glDisable(GL11.GL_FOG); - GlStateManager.color(1,1,1,1); + GlStateManager.disableFog(); + GL11.glDisable(GL11.GL_FOG); + GlStateManager.color(1, 1, 1, 1); GlStateManager.disableDepth(); GlStateManager.depthMask(false); mainPanel.render0(scaledResolution, new Point(0,0), new Rectangle(0,0,scaledResolution.getScaledWidth(),scaledResolution.getScaledHeight()), mouseX, mouseY, mouseX, mouseY, partialTicks); @@ -69,6 +71,8 @@ public class GuiGuiLocationConfig extends GuiScreen { GlStateManager.depthMask(true); GlStateManager.popAttrib(); GlStateManager.popMatrix(); + GlStateManager.enableBlend(); + GlStateManager.enableLighting(); } @Override diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiParameterValueEdit.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiParameterValueEdit.java index feceee7e..8b229656 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiParameterValueEdit.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiParameterValueEdit.java @@ -112,17 +112,23 @@ public class GuiParameterValueEdit extends GuiScreen { @Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { try { + ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); GlStateManager.pushMatrix(); GlStateManager.pushAttrib(); + GlStateManager.disableLighting(); + GlStateManager.disableFog(); + GL11.glDisable(GL11.GL_FOG); + GlStateManager.color(1, 1, 1, 1); GlStateManager.disableDepth(); GlStateManager.depthMask(false); - GlStateManager.disableLighting(); - GlStateManager.disableFog();GL11.glDisable(GL11.GL_FOG); - GlStateManager.color(1,1,1,1); - mainPanel.render0(scaledResolution, new Point(0, 0), new Rectangle(0, 0, scaledResolution.getScaledWidth(), scaledResolution.getScaledHeight()), mouseX, mouseY, mouseX, mouseY, partialTicks); - GlStateManager.popMatrix(); + mainPanel.render0(scaledResolution, new Point(0,0), new Rectangle(0,0,scaledResolution.getScaledWidth(),scaledResolution.getScaledHeight()), mouseX, mouseY, mouseX, mouseY, partialTicks); + GlStateManager.enableDepth(); + GlStateManager.depthMask(true); GlStateManager.popAttrib(); + GlStateManager.popMatrix(); + GlStateManager.enableBlend(); + GlStateManager.enableLighting(); } catch (Throwable e) { e.printStackTrace(); } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/MFeature.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/MFeature.java index d10730b7..f7d696e7 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/MFeature.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/MFeature.java @@ -7,12 +7,14 @@ import kr.syeyoung.dungeonsguide.gui.elements.MButton; import kr.syeyoung.dungeonsguide.gui.elements.MLabel; import kr.syeyoung.dungeonsguide.gui.elements.MStringSelectionButton; import kr.syeyoung.dungeonsguide.gui.elements.MToggleButton; +import kr.syeyoung.dungeonsguide.utils.RenderUtils; import lombok.Getter; import lombok.Setter; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.Gui; import net.minecraft.client.renderer.GlStateManager; +import org.lwjgl.opengl.GL11; import java.awt.*; import java.util.Arrays; @@ -79,13 +81,13 @@ public class MFeature extends MPanel { @Override public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) { - Gui.drawRect(0,0,getBounds().width, getBounds().height,0xFF444444); + RenderUtils.drawRectSafe(0,0,getBounds().width, getBounds().height,0xFF444444); if (hover != null && new Rectangle(new Point(0,0),getBounds().getSize()).contains(relMousex0, relMousey0)) { - Gui.drawRect(1,18,getBounds().width -1, getBounds().height-1, hover.getRGB()); + RenderUtils.drawRectSafe(1,18,getBounds().width -1, getBounds().height-1, hover.getRGB()); } else { - Gui.drawRect(1,18,getBounds().width -1, getBounds().height-1, 0xFF545454); + RenderUtils.drawRectSafe(1,18,getBounds().width -1, getBounds().height-1, 0xFF545454); } - Gui.drawRect(0,17,getBounds().width, 18,0xFF444444); + RenderUtils.drawRectSafe(0,17,getBounds().width, 18,0xFF444444); FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/MParameter.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/MParameter.java index 6906f615..f7572c30 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/MParameter.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/MParameter.java @@ -9,6 +9,7 @@ import kr.syeyoung.dungeonsguide.gui.elements.MToggleButton; import kr.syeyoung.dungeonsguide.roomedit.Parameter; import kr.syeyoung.dungeonsguide.gui.elements.MButton; import kr.syeyoung.dungeonsguide.gui.elements.MLabel; +import kr.syeyoung.dungeonsguide.utils.RenderUtils; import lombok.Getter; import lombok.Setter; import net.minecraft.client.Minecraft; @@ -103,7 +104,7 @@ public class MParameter extends MPanel { @Override public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) { if (hover != null && new Rectangle(new Point(0,0),getBounds().getSize()).contains(relMousex0, relMousey0)) { - Gui.drawRect(0,0,getBounds().width, getBounds().height, hover.getRGB()); + RenderUtils.drawRectSafe(0,0,getBounds().width, getBounds().height, hover.getRGB()); } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/PanelDelegate.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/PanelDelegate.java index 14661871..c02f04b8 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/PanelDelegate.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/PanelDelegate.java @@ -3,6 +3,7 @@ package kr.syeyoung.dungeonsguide.config.guiconfig; import kr.syeyoung.dungeonsguide.config.types.GUIRectangle; import kr.syeyoung.dungeonsguide.features.GuiFeature; import kr.syeyoung.dungeonsguide.gui.MPanel; +import kr.syeyoung.dungeonsguide.utils.RenderUtils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.ScaledResolution; @@ -30,21 +31,21 @@ public class PanelDelegate extends MPanel { GlStateManager.popMatrix(); if (!draggable) return; - Gui.drawRect(0,0, 3, 3, 0xFFBBBBBB); - Gui.drawRect(0, getBounds().height - 3, 3, getBounds().height, 0xFFBBBBBB); - Gui.drawRect(getBounds().width - 3,0, getBounds().width, 3, 0xFFBBBBBB); - Gui.drawRect(getBounds().width - 3,getBounds().height - 3, getBounds().width, getBounds().height, 0xFFBBBBBB); + RenderUtils.drawRectSafe(0,0, 3, 3, 0xFFBBBBBB); + RenderUtils.drawRectSafe(0, getBounds().height - 3, 3, getBounds().height, 0xFFBBBBBB); + RenderUtils.drawRectSafe(getBounds().width - 3,0, getBounds().width, 3, 0xFFBBBBBB); + RenderUtils.drawRectSafe(getBounds().width - 3,getBounds().height - 3, getBounds().width, getBounds().height, 0xFFBBBBBB); if (lastAbsClip.contains(absMousex, absMousey)) { if (relMouseX < 3 && relMouseY < 3) { - Gui.drawRect(0,0, 3, 3, 0x55FFFFFF); + RenderUtils.drawRectSafe(0,0, 3, 3, 0x55FFFFFF); } else if (relMouseX < 3 && relMouseY > getBounds().height - 3) { - Gui.drawRect(0, getBounds().height - 3, 3, getBounds().height, 0x55FFFFFF); + RenderUtils.drawRectSafe(0, getBounds().height - 3, 3, getBounds().height, 0x55FFFFFF); } else if (relMouseX > getBounds().width - 3 && relMouseY > getBounds().height - 3) { - Gui.drawRect(getBounds().width - 3,getBounds().height - 3, getBounds().width, getBounds().height, 0x55FFFFFF); + RenderUtils.drawRectSafe(getBounds().width - 3,getBounds().height - 3, getBounds().width, getBounds().height, 0x55FFFFFF); } else if (relMouseX > getBounds().width - 3 && relMouseY < 3) { - Gui.drawRect(getBounds().width - 3,0, getBounds().width, 3, 0x55FFFFFF); + RenderUtils.drawRectSafe(getBounds().width - 3,0, getBounds().width, 3, 0x55FFFFFF); } else if (selectedPart == -2){ - Gui.drawRect(0,0, getBounds().width, getBounds().height, 0x55FFFFFF); + RenderUtils.drawRectSafe(0,0, getBounds().width, getBounds().height, 0x55FFFFFF); } } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/DungeonListener.java b/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/DungeonListener.java index a4e853de..2bb6f72b 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/DungeonListener.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/DungeonListener.java @@ -27,6 +27,7 @@ import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiErrorScreen; import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.passive.EntityBat; import net.minecraft.util.ChatComponentText; import net.minecraft.util.Vec3; @@ -82,6 +83,7 @@ public class DungeonListener { dungeonRoom.getRoomProcessor().onPostGuiRender(e); } } + GlStateManager.enableBlend(); } catch (Throwable e2) {e2.printStackTrace();} } @SubscribeEvent @@ -232,6 +234,7 @@ public class DungeonListener { } } + GlStateManager.enableBlend(); } catch (Throwable e) { e.printStackTrace(); } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/FeatureListener.java b/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/FeatureListener.java index 0c54297d..54d107ed 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/FeatureListener.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/FeatureListener.java @@ -49,6 +49,7 @@ public class FeatureListener { ((ScreenRenderListener) abstractFeature).drawScreen(postRender.partialTicks); } } + GlStateManager.enableBlend(); } catch (Throwable t) { t.printStackTrace(); } @@ -266,6 +267,7 @@ public class FeatureListener { ((GuiPostRenderListener) abstractFeature).onGuiPostRender(render); } } + GlStateManager.enableBlend(); } catch (Throwable t) { t.printStackTrace(); } @@ -281,6 +283,7 @@ public class FeatureListener { ((GuiPreRenderListener) abstractFeature).onGuiPreRender(render); } } + GlStateManager.enableBlend(); } catch (Throwable t) { t.printStackTrace(); } @@ -296,6 +299,7 @@ public class FeatureListener { ((GuiBackgroundRenderListener) abstractFeature).onGuiBGRender(render); } } + GlStateManager.enableBlend(); } catch (Throwable t) { t.printStackTrace(); } 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); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/MPanel.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/MPanel.java index ce3dd669..06bbe67a 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/gui/MPanel.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/MPanel.java @@ -6,6 +6,9 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import org.lwjgl.opengl.GL11; import java.awt.*; @@ -88,7 +91,8 @@ public class MPanel { GL11.glEnable(GL11.GL_SCISSOR_TEST); GlStateManager.pushAttrib(); - GuiScreen.drawRect(0,0, getBounds().width, getBounds().height, backgroundColor.getRGB()); + GuiScreen.drawRect(0,0, getBounds().width, getBounds().height, 0x0000FF00); + GlStateManager.enableBlend(); GlStateManager.popAttrib(); GlStateManager.pushMatrix(); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MButton.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MButton.java index ff420a32..998bb40e 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MButton.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MButton.java @@ -1,6 +1,7 @@ package kr.syeyoung.dungeonsguide.gui.elements; import kr.syeyoung.dungeonsguide.gui.MPanel; +import kr.syeyoung.dungeonsguide.utils.RenderUtils; import lombok.Getter; import lombok.Setter; import net.minecraft.client.Minecraft; @@ -34,7 +35,7 @@ public class MButton extends MPanel { bg = hover; } if (bg != null) - Gui.drawRect(0,0,getBounds().width, getBounds().height, bg.getRGB()); + RenderUtils.drawRectSafe(0,0,getBounds().width, getBounds().height, bg.getRGB()); FontRenderer renderer = Minecraft.getMinecraft().fontRendererObj; int width = renderer.getStringWidth(getText()); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MColor.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MColor.java index 44be2d13..1bb993aa 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MColor.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MColor.java @@ -1,6 +1,7 @@ package kr.syeyoung.dungeonsguide.gui.elements; import kr.syeyoung.dungeonsguide.gui.MPanel; +import kr.syeyoung.dungeonsguide.utils.RenderUtils; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; @@ -25,6 +26,6 @@ public class MColor extends MPanel { int x = (rectangle.width - getSize().width) / 2; int y = (rectangle.height - getSize().height) / 2; - Gui.drawRect(x,y,x+getSize().width,y+getSize().height, getColor().getRGB()); + RenderUtils.drawRectSafe(x,y,x+getSize().width,y+getSize().height, getColor().getRGB()); } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MEditableAColor.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MEditableAColor.java index 7a96264f..97e93576 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MEditableAColor.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MEditableAColor.java @@ -45,12 +45,12 @@ public class MEditableAColor extends MPanel { int x = (rectangle.width - getSize().width) / 2; int y = (rectangle.height - getSize().height) / 2; - Gui.drawRect(x,y,x+getSize().width,y+getSize().height, RenderUtils.getColorAt(absMousex - relMousex0, absMousey - relMousey0, color)); + RenderUtils.drawRectSafe(x,y,x+getSize().width,y+getSize().height, RenderUtils.getColorAt(absMousex - relMousex0, absMousey - relMousey0, color)); - Gui.drawRect(x,y,x+getSize().width,y+1, 0xff333333); - Gui.drawRect(x,y,x+1,y+getSize().height, 0xff333333); - Gui.drawRect(x+getSize().width-1,y,x+getSize().width,y+getSize().height, 0xff333333); - Gui.drawRect(x,y+getSize().height-1,x+getSize().width,y+getSize().height, 0xff333333); + RenderUtils.drawRectSafe(x,y,x+getSize().width,y+1, 0xff333333); + RenderUtils.drawRectSafe(x,y,x+1,y+getSize().height, 0xff333333); + RenderUtils.drawRectSafe(x+getSize().width-1,y,x+getSize().width,y+getSize().height, 0xff333333); + RenderUtils.drawRectSafe(x,y+getSize().height-1,x+getSize().width,y+getSize().height, 0xff333333); } @Override diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MLabelAndElement.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MLabelAndElement.java index 601cb1aa..8ab6cb6e 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MLabelAndElement.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MLabelAndElement.java @@ -1,6 +1,7 @@ package kr.syeyoung.dungeonsguide.gui.elements; import kr.syeyoung.dungeonsguide.gui.MPanel; +import kr.syeyoung.dungeonsguide.utils.RenderUtils; import lombok.Getter; import lombok.Setter; import net.minecraft.client.gui.Gui; @@ -26,7 +27,7 @@ public class MLabelAndElement extends MPanel { @Override public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) { if (hover != null && new Rectangle(new Point(0,0),getBounds().getSize()).contains(relMousex0, relMousey0)) { - Gui.drawRect(0,0,getBounds().width, getBounds().height, hover.getRGB()); + RenderUtils.drawRectSafe(0,0,getBounds().width, getBounds().height, hover.getRGB()); } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MNavigatingPane.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MNavigatingPane.java index 87160cb6..b5b6c6ad 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MNavigatingPane.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MNavigatingPane.java @@ -2,6 +2,7 @@ package kr.syeyoung.dungeonsguide.gui.elements; import com.google.common.base.Function; import kr.syeyoung.dungeonsguide.gui.MPanel; +import kr.syeyoung.dungeonsguide.utils.RenderUtils; import lombok.Getter; import lombok.Setter; import net.minecraft.client.Minecraft; @@ -60,8 +61,8 @@ public class MNavigatingPane extends MPanel { @Override public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) { - Gui.drawRect(0, 15, getBounds().width, getBounds().height, 0xFF444444); - Gui.drawRect(1, 16, getBounds().width-1, getBounds().height-1, background2 != null ? background2.getRGB() : 0); + RenderUtils.drawRectSafe(0, 15, getBounds().width, getBounds().height, 0xFF444444); + RenderUtils.drawRectSafe(1, 16, getBounds().width-1, getBounds().height-1, background2 != null ? background2.getRGB() : 0); FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; fr.drawString(currentPage.replace(".", " > "), 20, 20, 0xFFFFFFFF); @@ -163,9 +164,9 @@ public class MNavigatingPane extends MPanel { } else if (new Rectangle(new Point(0,0),bounds).contains(relMousex0, relMousey0)) { bg = hover; } - Gui.drawRect(0, tabbedPane.getCurrentPage().equals(address) ? 0 : 2, getBounds().width, getBounds().height, 0xFF444444); + RenderUtils.drawRectSafe(0, tabbedPane.getCurrentPage().equals(address) ? 0 : 2, getBounds().width, getBounds().height, 0xFF444444); if (bg != null) - Gui.drawRect(1,tabbedPane.getCurrentPage().equals(address) ? 1 : 3,getBounds().width - 1, getBounds().height, bg.getRGB()); + RenderUtils.drawRectSafe(1,tabbedPane.getCurrentPage().equals(address) ? 1 : 3,getBounds().width - 1, getBounds().height, bg.getRGB()); FontRenderer renderer = Minecraft.getMinecraft().fontRendererObj; int width = renderer.getStringWidth(text); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MParameter.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MParameter.java index bc7f81e1..46d26e7f 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MParameter.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MParameter.java @@ -5,6 +5,7 @@ import kr.syeyoung.dungeonsguide.gui.MPanel; import kr.syeyoung.dungeonsguide.roomedit.Parameter; import kr.syeyoung.dungeonsguide.roomedit.gui.GuiDungeonParameterEdit; import kr.syeyoung.dungeonsguide.roomedit.panes.DynamicEditor; +import kr.syeyoung.dungeonsguide.utils.RenderUtils; import lombok.Getter; import lombok.Setter; import net.minecraft.client.gui.Gui; @@ -45,7 +46,7 @@ public class MParameter extends MPanel { @Override public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) { if (hover != null && new Rectangle(new Point(0,0),getBounds().getSize()).contains(relMousex0, relMousey0)) { - Gui.drawRect(0,0,getBounds().width, getBounds().height, hover.getRGB()); + RenderUtils.drawRectSafe(0,0,getBounds().width, getBounds().height, hover.getRGB()); } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MPortableColorEdit.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MPortableColorEdit.java index 138846b8..641d04a7 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MPortableColorEdit.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MPortableColorEdit.java @@ -71,8 +71,8 @@ public class MPortableColorEdit extends MPanel { @Override public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) { - Gui.drawRect(0,0,getSize().width,getSize().height, 0xff333333); - Gui.drawRect(1,1,getSize().width-1,getSize().height-1, 0xffa1a1a1); + RenderUtils.drawRectSafe(0,0,getSize().width,getSize().height, 0xff333333); + RenderUtils.drawRectSafe(1,1,getSize().width-1,getSize().height-1, 0xffa1a1a1); int width = getBounds().height- 35; Tessellator tessellator = Tessellator.getInstance(); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTabbedPane.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTabbedPane.java index dc14264b..f443342c 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTabbedPane.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTabbedPane.java @@ -38,7 +38,7 @@ public class MTabbedPane extends MPanel { @Override public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) { - Gui.drawRect(0, 15, getBounds().width, getBounds().height, 0xFF444444); + RenderUtils.drawRectSafe(0, 15, getBounds().width, getBounds().height, 0xFF444444); } public void addTab(String tab, MPanel panel) { @@ -114,9 +114,9 @@ public class MTabbedPane extends MPanel { } else if (new Rectangle(new Point(0,0),bounds).contains(relMousex0, relMousey0)) { bg = hover; } - Gui.drawRect(0, tabbedPane.getSelectedKey().equals(text) ? 0 : 2, getBounds().width, getBounds().height, 0xFF444444); + RenderUtils.drawRectSafe(0, tabbedPane.getSelectedKey().equals(text) ? 0 : 2, getBounds().width, getBounds().height, 0xFF444444); if (bg != null) - Gui.drawRect(1,tabbedPane.getSelectedKey().equals(text) ? 1 : 3,getBounds().width - 1, getBounds().height, bg.getRGB()); + RenderUtils.drawRectSafe(1,tabbedPane.getSelectedKey().equals(text) ? 1 : 3,getBounds().width - 1, getBounds().height, bg.getRGB()); FontRenderer renderer = Minecraft.getMinecraft().fontRendererObj; int width = renderer.getStringWidth(text); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTextField.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTextField.java index d3f2b2c0..8c5ce1c8 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTextField.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTextField.java @@ -1,6 +1,7 @@ package kr.syeyoung.dungeonsguide.gui.elements; import kr.syeyoung.dungeonsguide.gui.MPanel; +import kr.syeyoung.dungeonsguide.utils.RenderUtils; import lombok.Getter; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; @@ -42,8 +43,8 @@ public class MTextField extends MPanel { @Override public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle clip) { - Gui.drawRect(0,0,getBounds().width, getBounds().height, isFocused ? Color.white.getRGB() : Color.gray.getRGB()); - Gui.drawRect(1,1,getBounds().width - 1, getBounds().height - 1, Color.black.getRGB()); + RenderUtils.drawRectSafe(0,0,getBounds().width, getBounds().height, isFocused ? Color.white.getRGB() : Color.gray.getRGB()); + RenderUtils.drawRectSafe(1,1,getBounds().width - 1, getBounds().height - 1, Color.black.getRGB()); Minecraft mc = Minecraft.getMinecraft(); clip(new ScaledResolution(mc), clip.x + 1, clip.y + 1, clip.width - 2, clip.height - 2); @@ -55,7 +56,7 @@ public class MTextField extends MPanel { if (selectionStart != -1) { int startX = fr.getStringWidth(text.substring(0, selectionStart)) - xOffset; int endX = fr.getStringWidth(text.substring(0, selectionEnd)) - xOffset; - Gui.drawRect(3 + startX, y, 3 + endX, y + fr.FONT_HEIGHT, 0xFF00FF00); + RenderUtils.drawRectSafe(3 + startX, y, 3 + endX, y + fr.FONT_HEIGHT, 0xFF00FF00); fr.drawString(text.substring(selectionStart, selectionEnd), 3 + startX, y, foreground.getRGB()); } @@ -65,7 +66,7 @@ public class MTextField extends MPanel { int x = fr.getStringWidth(text.substring(0, cursor)) - xOffset; cursorBlickTicker++; if (cursorBlickTicker < 10) - Gui.drawRect(3 + x, y, 4 + x, y + fr.FONT_HEIGHT, 0xFFFFFFFF); + RenderUtils.drawRectSafe(3 + x, y, 4 + x, y + fr.FONT_HEIGHT, 0xFFFFFFFF); if (cursorBlickTicker == 20) cursorBlickTicker = 0; } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MToggleButton.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MToggleButton.java index 5d2d4d67..8c217231 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MToggleButton.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MToggleButton.java @@ -1,6 +1,7 @@ package kr.syeyoung.dungeonsguide.gui.elements; import kr.syeyoung.dungeonsguide.gui.MPanel; +import kr.syeyoung.dungeonsguide.utils.RenderUtils; import lombok.Getter; import lombok.Setter; import net.minecraft.client.Minecraft; @@ -23,8 +24,8 @@ public class MToggleButton extends MPanel { int gap = 1; - Gui.drawRect(0, 0, bounds.width, bounds.height, 0xFF333333); - Gui.drawRect(gap, gap, bounds.width-gap, bounds.height-gap, 0xFF171717); + RenderUtils.drawRectSafe(0, 0, bounds.width, bounds.height, 0xFF333333); + RenderUtils.drawRectSafe(gap, gap, bounds.width-gap, bounds.height-gap, 0xFF171717); FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; @@ -35,14 +36,14 @@ public class MToggleButton extends MPanel { GlStateManager.scale(1.0/scale,1.0/scale,0); fr.drawString("ON", x, x, 0xFF9B9B9B); GlStateManager.popMatrix(); - Gui.drawRect(bounds.width - bounds.height+gap,gap, bounds.width - gap, bounds.height - gap, 0xFF00B200); + RenderUtils.drawRectSafe(bounds.width - bounds.height+gap,gap, bounds.width - gap, bounds.height - gap, 0xFF00B200); } else { GlStateManager.pushMatrix(); GlStateManager.scale(1.0/scale,1.0/scale,0); int x = (int) ((scale * bounds.height - fr.FONT_HEIGHT)/2 + gap); fr.drawString("OFF", (int) (scale * bounds.width - x - fr.getStringWidth("OFF")), x, 0xFF9B9B9B); GlStateManager.popMatrix(); - Gui.drawRect(gap,gap, bounds.height - gap, bounds.height - gap, 0xFFCD4000); + RenderUtils.drawRectSafe(gap,gap, bounds.height - gap, bounds.height - gap, 0xFFCD4000); } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MValue.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MValue.java index e4e51841..a18063c6 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MValue.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MValue.java @@ -4,6 +4,7 @@ import kr.syeyoung.dungeonsguide.roomedit.EditingContext; import kr.syeyoung.dungeonsguide.gui.MPanel; import kr.syeyoung.dungeonsguide.roomedit.gui.GuiDungeonValueEdit; import kr.syeyoung.dungeonsguide.roomedit.valueedit.ValueEditOffsetPointSet; +import kr.syeyoung.dungeonsguide.utils.RenderUtils; import lombok.Getter; import lombok.Setter; import net.minecraft.client.gui.Gui; @@ -37,7 +38,7 @@ public class MValue<T> extends MPanel { @Override public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) { if (hover != null && new Rectangle(new Point(0,0),getBounds().getSize()).contains(relMousex0, relMousey0)) { - Gui.drawRect(0,0,getBounds().width, getBounds().height, hover.getRGB()); + RenderUtils.drawRectSafe(0,0,getBounds().width, getBounds().height, hover.getRGB()); } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/party/PartyInviteViewer.java b/src/main/java/kr/syeyoung/dungeonsguide/party/PartyInviteViewer.java index 845b7308..79c1faa9 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/party/PartyInviteViewer.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/party/PartyInviteViewer.java @@ -7,6 +7,7 @@ import kr.syeyoung.dungeonsguide.features.AbstractFeature; import kr.syeyoung.dungeonsguide.features.FeatureRegistry; import kr.syeyoung.dungeonsguide.features.GuiFeature; import kr.syeyoung.dungeonsguide.features.listener.ScreenRenderListener; +import kr.syeyoung.dungeonsguide.utils.RenderUtils; import kr.syeyoung.dungeonsguide.utils.TextUtils; import net.arikia.dev.drpc.DiscordRPC; import net.minecraft.client.Minecraft; @@ -162,6 +163,7 @@ public class PartyInviteViewer { y += height + gap; } GlStateManager.popMatrix(); + GlStateManager.enableBlend(); } catch (Throwable t) { t.printStackTrace(); } @@ -180,8 +182,8 @@ public class PartyInviteViewer { GlStateManager.pushMatrix(); GlStateManager.translate(x,y,0); - Gui.drawRect(0, 0,width,height, 0xFF23272a); - Gui.drawRect(2, 2, width-2, height-2, 0XFF2c2f33); + RenderUtils.drawRectSafe(0, 0,width,height, 0xFF23272a); + RenderUtils.drawRectSafe(2, 2, width-2, height-2, 0XFF2c2f33); { String avatar = "https://cdn.discordapp.com/avatars/"+partyJoinRequest.getDiscordUser().userId+"/"+partyJoinRequest.getDiscordUser().avatar+".png"; Future<LoadedImage> loadedImageFuture = loadImage(avatar); @@ -212,7 +214,7 @@ public class PartyInviteViewer { GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit); GlStateManager.popAttrib(); } else { - Gui.drawRect(7, 7, height - 7, height-7, 0xFF4E4E4E); + RenderUtils.drawRectSafe(7, 7, height - 7, height-7, 0xFF4E4E4E); } } @@ -242,7 +244,7 @@ public class PartyInviteViewer { GlStateManager.pushMatrix(); String text = "Accept"; partyJoinRequest.getAcceptRect().setBounds(x + height + 3, y + height - 25, widthForTheThing - 10, 25); - Gui.drawRect(0, 0, widthForTheThing - 10, 25, hover && partyJoinRequest.getAcceptRect().contains(mouseX, mouseY) ? 0xFF859DF0 : 0xFF7289da); + RenderUtils.drawRectSafe(0, 0, widthForTheThing - 10, 25, hover && partyJoinRequest.getAcceptRect().contains(mouseX, mouseY) ? 0xFF859DF0 : 0xFF7289da); GlStateManager.translate((widthForTheThing - 10 - fr.getStringWidth(text) * 2) / 2, 15 - fr.FONT_HEIGHT, 0); GlStateManager.scale(2.0f, 2.0f, 1.0f); @@ -250,7 +252,7 @@ public class PartyInviteViewer { GlStateManager.popMatrix(); GlStateManager.translate(widthForTheThing, 0, 0); partyJoinRequest.getDenyRect().setBounds(x + height + 3 + widthForTheThing, y + height - 25, widthForTheThing - 10, 25); - Gui.drawRect(0, 0, widthForTheThing - 10, 25, hover && partyJoinRequest.getDenyRect().contains(mouseX, mouseY) ? 0xFFAEC0CB : 0xFF99aab5); + RenderUtils.drawRectSafe(0, 0, widthForTheThing - 10, 25, hover && partyJoinRequest.getDenyRect().contains(mouseX, mouseY) ? 0xFFAEC0CB : 0xFF99aab5); GlStateManager.pushMatrix(); text = "Deny"; GlStateManager.translate((widthForTheThing - 10 - fr.getStringWidth(text) * 2) / 2, 15 - fr.FONT_HEIGHT, 0); @@ -259,7 +261,7 @@ public class PartyInviteViewer { GlStateManager.popMatrix(); GlStateManager.translate(widthForTheThing, 0, 0); partyJoinRequest.getIgnoreRect().setBounds(x + height + 3 + widthForTheThing + widthForTheThing, y + height - 25, widthForTheThing - 10, 25); - Gui.drawRect(0, 0, widthForTheThing - 10, 25, hover && partyJoinRequest.getIgnoreRect().contains(mouseX, mouseY) ? 0xFFAEC0CB : 0xFF99aab5); // AEC0CB + RenderUtils.drawRectSafe(0, 0, widthForTheThing - 10, 25, hover && partyJoinRequest.getIgnoreRect().contains(mouseX, mouseY) ? 0xFFAEC0CB : 0xFF99aab5); // AEC0CB GlStateManager.pushMatrix(); text = "Ignore"; GlStateManager.translate((widthForTheThing - 10 - fr.getStringWidth(text) * 2) / 2, 15 - fr.FONT_HEIGHT, 0); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonAddSet.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonAddSet.java index d8cf391e..da08a330 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonAddSet.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonAddSet.java @@ -127,19 +127,24 @@ public class GuiDungeonAddSet extends GuiScreen { @Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { + + ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); GlStateManager.pushMatrix(); GlStateManager.pushAttrib(); + GlStateManager.disableLighting(); + GlStateManager.disableFog(); + GL11.glDisable(GL11.GL_FOG); + GlStateManager.color(1, 1, 1, 1); GlStateManager.disableDepth(); GlStateManager.depthMask(false); - GlStateManager.disableLighting(); - GlStateManager.disableFog();GL11.glDisable(GL11.GL_FOG); - GlStateManager.color(1,1,1,1); - GlStateManager.pushAttrib(); mainPanel.render0(scaledResolution, new Point(0,0), new Rectangle(0,0,scaledResolution.getScaledWidth(),scaledResolution.getScaledHeight()), mouseX, mouseY, mouseX, mouseY, partialTicks); + GlStateManager.enableDepth(); + GlStateManager.depthMask(true); GlStateManager.popAttrib(); GlStateManager.popMatrix(); - GlStateManager.popAttrib(); + GlStateManager.enableBlend(); + GlStateManager.enableLighting(); } @Override diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonParameterEdit.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonParameterEdit.java index e39b136a..9857b509 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonParameterEdit.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonParameterEdit.java @@ -163,19 +163,23 @@ public class GuiDungeonParameterEdit extends GuiScreen { @Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { + ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); GlStateManager.pushMatrix(); GlStateManager.pushAttrib(); + GlStateManager.disableLighting(); + GlStateManager.disableFog(); + GL11.glDisable(GL11.GL_FOG); + GlStateManager.color(1, 1, 1, 1); GlStateManager.disableDepth(); GlStateManager.depthMask(false); - GlStateManager.disableLighting(); - GlStateManager.disableFog();GL11.glDisable(GL11.GL_FOG); - GlStateManager.color(1,1,1,1); - GlStateManager.pushAttrib(); mainPanel.render0(scaledResolution, new Point(0,0), new Rectangle(0,0,scaledResolution.getScaledWidth(),scaledResolution.getScaledHeight()), mouseX, mouseY, mouseX, mouseY, partialTicks); - GlStateManager.popAttrib(); + GlStateManager.enableDepth(); + GlStateManager.depthMask(true); GlStateManager.popAttrib(); GlStateManager.popMatrix(); + GlStateManager.enableBlend(); + GlStateManager.enableLighting(); } @Override diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonRoomEdit.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonRoomEdit.java index 34d7f740..f7638fc7 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonRoomEdit.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonRoomEdit.java @@ -59,19 +59,23 @@ public class GuiDungeonRoomEdit extends GuiScreen { @Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { + ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); GlStateManager.pushMatrix(); GlStateManager.pushAttrib(); + GlStateManager.disableLighting(); + GlStateManager.disableFog(); + GL11.glDisable(GL11.GL_FOG); + GlStateManager.color(1, 1, 1, 1); GlStateManager.disableDepth(); GlStateManager.depthMask(false); - GlStateManager.disableLighting(); - GlStateManager.disableFog();GL11.glDisable(GL11.GL_FOG); - GlStateManager.color(1,1,1,1); - GlStateManager.pushAttrib(); mainPanel.render0(scaledResolution, new Point(0,0), new Rectangle(0,0,scaledResolution.getScaledWidth(),scaledResolution.getScaledHeight()), mouseX, mouseY, mouseX, mouseY, partialTicks); - GlStateManager.popAttrib(); + GlStateManager.enableDepth(); + GlStateManager.depthMask(true); GlStateManager.popAttrib(); GlStateManager.popMatrix(); + GlStateManager.enableBlend(); + GlStateManager.enableLighting(); } @Override diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonValueEdit.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonValueEdit.java index 74bffd78..8601275c 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonValueEdit.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonValueEdit.java @@ -120,19 +120,23 @@ public class GuiDungeonValueEdit extends GuiScreen { @Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { try { + ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); GlStateManager.pushMatrix(); GlStateManager.pushAttrib(); + GlStateManager.disableLighting(); + GlStateManager.disableFog(); + GL11.glDisable(GL11.GL_FOG); + GlStateManager.color(1, 1, 1, 1); GlStateManager.disableDepth(); GlStateManager.depthMask(false); - GlStateManager.disableLighting(); - GlStateManager.disableFog();GL11.glDisable(GL11.GL_FOG); - GlStateManager.color(1,1,1,1); - GlStateManager.pushAttrib(); - mainPanel.render0(scaledResolution, new Point(0, 0), new Rectangle(0, 0, scaledResolution.getScaledWidth(), scaledResolution.getScaledHeight()), mouseX, mouseY, mouseX, mouseY, partialTicks); - GlStateManager.popAttrib(); + mainPanel.render0(scaledResolution, new Point(0,0), new Rectangle(0,0,scaledResolution.getScaledWidth(),scaledResolution.getScaledHeight()), mouseX, mouseY, mouseX, mouseY, partialTicks); + GlStateManager.enableDepth(); + GlStateManager.depthMask(true); GlStateManager.popAttrib(); GlStateManager.popMatrix(); + GlStateManager.enableBlend(); + GlStateManager.enableLighting(); } catch (Throwable e) { e.printStackTrace(); } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/ActionTreeDisplayPane.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/ActionTreeDisplayPane.java index 3a111436..a0c17ef8 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/ActionTreeDisplayPane.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/ActionTreeDisplayPane.java @@ -5,6 +5,7 @@ import kr.syeyoung.dungeonsguide.dungeon.actions.tree.ActionTree; import kr.syeyoung.dungeonsguide.dungeon.actions.tree.ActionTreeUtil; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; import kr.syeyoung.dungeonsguide.gui.MPanel; +import kr.syeyoung.dungeonsguide.utils.RenderUtils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.Gui; @@ -155,8 +156,8 @@ public class ActionTreeDisplayPane extends MPanel { int offset = 2; int height = (fr.FONT_HEIGHT + offset) * lines.length; - Gui.drawRect(x,y,x + maxWidth +10, y + height + 10, 0xff000000); - Gui.drawRect(x+1,y+1,x + maxWidth +8, y + height + 8, 0xff4d4d4d); + RenderUtils.drawRectSafe(x,y,x + maxWidth +10, y + height + 10, 0xff000000); + RenderUtils.drawRectSafe(x+1,y+1,x + maxWidth +8, y + height + 8, 0xff4d4d4d); for (int i = 0; i < lines.length; i++) { fr.drawString(lines[i], x + 5, y + 5 + i*(fr.FONT_HEIGHT + offset), 0xffffffff); } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/RoomDataDisplayPane.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/RoomDataDisplayPane.java index 86739f46..fcd8e69b 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/RoomDataDisplayPane.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/RoomDataDisplayPane.java @@ -2,6 +2,7 @@ package kr.syeyoung.dungeonsguide.roomedit.panes; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; import kr.syeyoung.dungeonsguide.gui.MPanel; +import kr.syeyoung.dungeonsguide.utils.RenderUtils; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; @@ -33,14 +34,14 @@ public class RoomDataDisplayPane extends MPanel { int[][] blocks = dungeonRoom.getDungeonRoomInfo().getBlocks(); // draw Axis; - Gui.drawRect(0,0,10,10,0x77777777); + RenderUtils.drawRectSafe(0,0,10,10,0x77777777); clip(sr, clip.x + 10, clip.y, clip.width - 10, 10); - Gui.drawRect(0,0,getBounds().width, getBounds().height, 0x77777777); + RenderUtils.drawRectSafe(0,0,getBounds().width, getBounds().height, 0x77777777); for (int x = 0; x < blocks[0].length; x++) { fr.drawString(x+"", x * 16 +10 + offsetX, 0, 0xFFFFFFFF); } clip(sr, clip.x, clip.y +10, 10, clip.height-10); - Gui.drawRect(0,0,getBounds().width, getBounds().height, 0x77777777); + RenderUtils.drawRectSafe(0,0,getBounds().width, getBounds().height, 0x77777777); for (int z = 0; z < blocks.length; z++) { fr.drawString(z+"", 2, z * 16 + 10 + offsetY, 0xFFFFFFFF); } @@ -53,9 +54,9 @@ public class RoomDataDisplayPane extends MPanel { for (int x = 0; x < blocks[z].length; x++) { int data = blocks[z][x]; if (z == selectedY && x == selectedX){ - Gui.drawRect(x *16 +10+offsetX, z *16 +10 + offsetY, x *16 +26 +offsetX, z *16 +26 + offsetY, 0xAA707070); + RenderUtils.drawRectSafe(x *16 +10+offsetX, z *16 +10 + offsetY, x *16 +26 +offsetX, z *16 +26 + offsetY, 0xAA707070); } else if (z == hoverY && x == hoverX) { - Gui.drawRect(x *16 +10+offsetX, z *16 +10 + offsetY, x *16 +26 +offsetX, z *16 +26 + offsetY, 0xAA505050); + RenderUtils.drawRectSafe(x *16 +10+offsetX, z *16 +10 + offsetY, x *16 +26 +offsetX, z *16 +26 + offsetY, 0xAA505050); } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/RoomMatchDisplayPane.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/RoomMatchDisplayPane.java index 4250045c..6c6cc6a5 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/RoomMatchDisplayPane.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/RoomMatchDisplayPane.java @@ -5,6 +5,7 @@ import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoomInfoRegistry; import kr.syeyoung.dungeonsguide.gui.MPanel; import kr.syeyoung.dungeonsguide.utils.ArrayUtils; +import kr.syeyoung.dungeonsguide.utils.RenderUtils; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; @@ -44,14 +45,14 @@ public class RoomMatchDisplayPane extends MPanel { int width = Math.max(currentBlocks[0].length, targetBlocks[0].length); // draw Axis; - Gui.drawRect(0,0,10,10,0x77777777); + RenderUtils.drawRectSafe(0,0,10,10,0x77777777); clip(sr, clip.x + 10, clip.y, clip.width - 10, 10); - Gui.drawRect(0,0,getBounds().width, getBounds().height, 0x77777777); + RenderUtils.drawRectSafe(0,0,getBounds().width, getBounds().height, 0x77777777); for (int x = 0; x < width; x++) { fr.drawString(x+"", x * 16 +10 + offsetX, 0, 0xFFFFFFFF); } clip(sr, clip.x, clip.y +10, 10, clip.height-10); - Gui.drawRect(0,0,getBounds().width, getBounds().height, 0x77777777); + RenderUtils.drawRectSafe(0,0,getBounds().width, getBounds().height, 0x77777777); for (int z = 0; z < height; z++) { fr.drawString(z+"", 2, z * 16 + 10 + offsetY, 0xFFFFFFFF); } @@ -72,7 +73,7 @@ public class RoomMatchDisplayPane extends MPanel { } if (z == hoverY && x == hoverX) { - Gui.drawRect(x *16 +10+offsetX, z *16 +10 + offsetY, x *16 +26 +offsetX, z *16 +26 + offsetY, 0xAA505050); + RenderUtils.drawRectSafe(x *16 +10+offsetX, z *16 +10 + offsetY, x *16 +26 +offsetX, z *16 +26 + offsetY, 0xAA505050); } if (data1 == data2) drawItemStack(new ItemStack(Item.getItemFromBlock(Block.getBlockById(data1)), 1), x * 16 +10 + offsetX, z *16 +10 + offsetY); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorBlazeSolver.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorBlazeSolver.java index d8401756..66f607b2 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorBlazeSolver.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorBlazeSolver.java @@ -137,7 +137,7 @@ public class RoomProcessorBlazeSolver extends GeneralRoomProcessor { GL11.glStencilFunc(GL11.GL_EQUAL, 1, 0xFF); GL11.glStencilOp(GL11.GL_KEEP, GL11.GL_KEEP, GL11.GL_KEEP); -// Gui.drawRect(-9999,-9999, 9999, 9999, 0xFFFFFFFF); +// RenderUtils.drawRectSafe(-9999,-9999, 9999, 9999, 0xFFFFFFFF); boolean border = true; diff --git a/src/main/java/kr/syeyoung/dungeonsguide/utils/RenderUtils.java b/src/main/java/kr/syeyoung/dungeonsguide/utils/RenderUtils.java index 35319e71..8ffcab39 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/utils/RenderUtils.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/utils/RenderUtils.java @@ -70,7 +70,6 @@ public class RenderUtils { } tessellator.draw(); GlStateManager.enableTexture2D(); - GlStateManager.disableBlend(); } @@ -118,6 +117,42 @@ public class RenderUtils { } tessellator.draw(); GlStateManager.enableTexture2D(); + GlStateManager.enableBlend(); + } + + public static void drawRectSafe(int left, int top, int right, int bottom, int color) + { + if (left < right) + { + int i = left; + left = right; + right = i; + } + + if (top < bottom) + { + int j = top; + top = bottom; + bottom = j; + } + + float f3 = (float)(color >> 24 & 255) / 255.0F; + float f = (float)(color >> 16 & 255) / 255.0F; + float f1 = (float)(color >> 8 & 255) / 255.0F; + float f2 = (float)(color & 255) / 255.0F; + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + GlStateManager.enableBlend(); + GlStateManager.disableTexture2D(); + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + GlStateManager.color(f, f1, f2, f3); + worldrenderer.begin(7, DefaultVertexFormats.POSITION); + worldrenderer.pos((double)left, (double)bottom, 0.0D).endVertex(); + worldrenderer.pos((double)right, (double)bottom, 0.0D).endVertex(); + worldrenderer.pos((double)right, (double)top, 0.0D).endVertex(); + worldrenderer.pos((double)left, (double)top, 0.0D).endVertex(); + tessellator.draw(); + GlStateManager.enableTexture2D(); GlStateManager.disableBlend(); } |