diff options
Diffstat (limited to 'src/main')
27 files changed, 250 insertions, 211 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 80879a9d..a9d81420 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiConfig.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiConfig.java @@ -46,16 +46,18 @@ public class GuiConfig extends GuiScreen { @Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); - GL11.glPushMatrix(); + GlStateManager.pushMatrix(); + GlStateManager.pushAttrib(); GlStateManager.disableLighting(); - GlStateManager.disableFog(); + GlStateManager.disableFog();GL11.glDisable(GL11.GL_FOG); GlStateManager.color(1,1,1,1); - GL11.glDisable(GL11.GL_DEPTH_TEST); - GL11.glDepthMask(false); + 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); - GL11.glEnable(GL11.GL_DEPTH_TEST); - GL11.glDepthMask(true); - GL11.glPopMatrix(); + GlStateManager.enableDepth(); + GlStateManager.depthMask(true); + GlStateManager.popAttrib(); + GlStateManager.popMatrix(); } @Override 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 fd491705..d7be3325 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiGuiLocationConfig.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiGuiLocationConfig.java @@ -57,16 +57,20 @@ public class GuiGuiLocationConfig extends GuiScreen { @Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); - GL11.glPushMatrix(); + GlStateManager.pushMatrix(); + GlStateManager.pushAttrib(); GlStateManager.disableLighting(); - GlStateManager.disableFog(); + GlStateManager.disableDepth(); + GlStateManager.depthMask(false); + GlStateManager.disableFog();GL11.glDisable(GL11.GL_FOG); GlStateManager.color(1,1,1,1); - GL11.glDisable(GL11.GL_DEPTH_TEST); - GL11.glDepthMask(false); + 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); - GL11.glEnable(GL11.GL_DEPTH_TEST); - GL11.glDepthMask(true); - GL11.glPopMatrix(); + GlStateManager.enableDepth(); + GlStateManager.depthMask(true); + GlStateManager.popAttrib(); + GlStateManager.popMatrix(); } @Override diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiParameterConfig.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiParameterConfig.java index d99d2cbb..fa80758c 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiParameterConfig.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiParameterConfig.java @@ -60,12 +60,13 @@ public class GuiParameterConfig extends GuiScreen { @Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); - GL11.glPushMatrix(); + GlStateManager.pushMatrix(); + GlStateManager.pushAttrib(); GlStateManager.disableLighting(); - GlStateManager.disableFog(); + GlStateManager.disableFog();GL11.glDisable(GL11.GL_FOG); GlStateManager.color(1,1,1,1); - GL11.glDisable(GL11.GL_DEPTH_TEST); - GL11.glDepthMask(false); + GlStateManager.disableDepth(); + GlStateManager.depthMask(false); int heights = 0; within = null; for (MPanel panel:mainPanel.getChildComponents()) { @@ -75,8 +76,8 @@ public class GuiParameterConfig extends GuiScreen { if (panel.getBounds().contains(mouseX - mainPanel.getBounds().x, mouseY - mainPanel.getBounds().y)) within = panel; } mainPanel.render0(scaledResolution, new Point(0,0), new Rectangle(0,0,scaledResolution.getScaledWidth(),scaledResolution.getScaledHeight()), mouseX, mouseY, mouseX, mouseY, partialTicks); - GL11.glPopMatrix(); - GL11.glPushMatrix(); + GlStateManager.popMatrix(); + GlStateManager.pushMatrix(); GlStateManager.color(1,1,1,1); if (within instanceof MParameter) { FeatureParameter feature = ((MParameter) within).getParameter(); @@ -84,9 +85,10 @@ public class GuiParameterConfig extends GuiScreen { drawHoveringText(new ArrayList<String>(Arrays.asList(feature.getDescription().split("\n"))), mouseX, mouseY, Minecraft.getMinecraft().fontRendererObj); GlStateManager.popAttrib(); } - GL11.glEnable(GL11.GL_DEPTH_TEST); - GL11.glDepthMask(true); - GL11.glPopMatrix(); + GlStateManager.enableDepth(); + GlStateManager.depthMask(true); + GlStateManager.popAttrib(); + GlStateManager.popMatrix(); } @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 6e8b1636..e3a51d1f 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiParameterValueEdit.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/GuiParameterValueEdit.java @@ -119,12 +119,16 @@ public class GuiParameterValueEdit extends GuiScreen { public void drawScreen(int mouseX, int mouseY, float partialTicks) { try { ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); - GL11.glPushMatrix(); + GlStateManager.pushMatrix(); + GlStateManager.pushAttrib(); + GlStateManager.disableDepth(); + GlStateManager.depthMask(false); GlStateManager.disableLighting(); - GlStateManager.disableFog(); + 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); - GL11.glPopMatrix(); + GlStateManager.popMatrix(); + GlStateManager.popAttrib(); } catch (Throwable e) { e.printStackTrace(); } 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 8fa6d371..5ceecc23 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.features.GuiFeature; import kr.syeyoung.dungeonsguide.roomedit.MPanel; import net.minecraft.client.gui.Gui; +import net.minecraft.client.renderer.GlStateManager; import org.lwjgl.opengl.GL11; import org.w3c.dom.css.Rect; @@ -21,9 +22,9 @@ public class PanelDelegate extends MPanel { @Override public void render(int absMousex, int absMousey, int relMouseX, int relMouseY, float partialTicks, Rectangle scissor) { - GL11.glPushMatrix(); + GlStateManager.pushMatrix(); guiFeature.drawDemo(partialTicks); - GL11.glPopMatrix(); + GlStateManager.popMatrix(); Gui.drawRect(0,0, 3, 3, 0xFFBBBBBB); Gui.drawRect(0, getBounds().height - 3, 3, getBounds().height, 0xFFBBBBBB); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/DungeonListener.java b/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/DungeonListener.java index 0fb4f92f..7ce151a3 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/DungeonListener.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/DungeonListener.java @@ -98,14 +98,14 @@ public class DungeonListener { SkyblockStatus skyblockStatus = (SkyblockStatus) e.getDungeonsGuide().getSkyblockStatus(); if (!skyblockStatus.isOnDungeon()) return; if (FeatureRegistry.DEBUG.isEnabled()) { - GL11.glPushMatrix(); + GlStateManager.pushMatrix(); int[] textureData = dynamicTexture.getTextureData(); MapUtils.getImage().getRGB(0, 0, 128, 128, textureData, 0, 128); dynamicTexture.updateDynamicTexture(); Minecraft.getMinecraft().getTextureManager().bindTexture(location); GlStateManager.enableAlpha(); GuiScreen.drawModalRectWithCustomSizedTexture(0, 0, 0, 0, 128, 128, 128, 128); - GL11.glPopMatrix(); + GlStateManager.popMatrix(); } if (skyblockStatus.getContext() != null) { diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/GuiFeature.java b/src/main/java/kr/syeyoung/dungeonsguide/features/GuiFeature.java index 947b4dc7..f15b10b5 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/GuiFeature.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/GuiFeature.java @@ -40,18 +40,18 @@ public abstract class GuiFeature extends AbstractFeature implements ScreenRender @Override public void drawScreen(float partialTicks) { if (!isEnabled()) return; - GL11.glPushMatrix(); + GlStateManager.pushMatrix(); GlStateManager.color(1,1,1,1); - GlStateManager.disableFog(); + GlStateManager.disableFog();GL11.glDisable(GL11.GL_FOG); GlStateManager.disableLighting(); clip(new ScaledResolution(Minecraft.getMinecraft()), featureRect.x, featureRect.y, featureRect.width, featureRect.height); GL11.glEnable(GL11.GL_SCISSOR_TEST); - GL11.glTranslated(featureRect.x, featureRect.y, 0); + GlStateManager.translate(featureRect.x, featureRect.y, 0); drawHUD(partialTicks); GL11.glDisable(GL11.GL_SCISSOR_TEST); - GL11.glPopMatrix(); + GlStateManager.popMatrix(); } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureChestPrice.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureChestPrice.java index d3792e77..d98a3bbc 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureChestPrice.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureChestPrice.java @@ -83,8 +83,8 @@ public class FeatureChestPrice extends SimpleFeature implements GuiBackgroundRen int width = 120; - GL11.glPushMatrix(); - GL11.glTranslated(left, top, 0); + GlStateManager.pushMatrix(); + GlStateManager.translate(left, top, 0); Gui.drawRect( 0,0,width, 30, 0xFFDDDDDD); FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; @@ -96,6 +96,6 @@ public class FeatureChestPrice extends SimpleFeature implements GuiBackgroundRen str = (itemPrice > chestPrice ? "+" : "") +TextUtils.format(itemPrice - chestPrice); fr.drawString(str, width - fr.getStringWidth(str) - 5, 15, itemPrice > chestPrice ? 0xFF00CC00 : 0xFFCC0000); - GL11.glPopMatrix(); + GlStateManager.popMatrix(); } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureCooldownCounter.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureCooldownCounter.java index 56ff4ce7..28fc7d0e 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureCooldownCounter.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureCooldownCounter.java @@ -8,6 +8,7 @@ import kr.syeyoung.dungeonsguide.features.listener.DungeonQuitListener; import kr.syeyoung.dungeonsguide.features.listener.TickListener; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.renderer.GlStateManager; import org.lwjgl.opengl.GL11; import java.awt.*; @@ -25,7 +26,7 @@ public class FeatureCooldownCounter extends GuiFeature implements DungeonQuitLis if (System.currentTimeMillis() - leftDungeonTime > 20000) return; FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; double scale = getFeatureRect().getHeight() / fr.FONT_HEIGHT; - GL11.glScaled(scale, scale, 0); + GlStateManager.scale(scale, scale, 0); fr.drawString("Cooldown: "+(20 - (System.currentTimeMillis() - leftDungeonTime) / 1000)+"s", 0,0,this.<Color>getParameter("color").getValue().getRGB()); } @@ -33,7 +34,7 @@ public class FeatureCooldownCounter extends GuiFeature implements DungeonQuitLis public void drawDemo(float partialTicks) { FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; double scale = getFeatureRect().getHeight() / fr.FONT_HEIGHT; - GL11.glScaled(scale, scale, 0); + GlStateManager.scale(scale, scale, 0); fr.drawString("Cooldown: 20s", 0,0,this.<Color>getParameter("color").getValue().getRGB()); } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonMap.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonMap.java index 4dab2953..4210749c 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonMap.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonMap.java @@ -114,13 +114,13 @@ public class FeatureDungeonMap extends GuiFeature implements DungeonEndListener, MapData mapData = mapProcessor.getLastMapData2(); Gui.drawRect(0,0,getFeatureRect().width, getFeatureRect().height, this.<AColor>getParameter("background_color").getValue().getRGB()); GlStateManager.color(1,1,1,1); - GL11.glPushMatrix();; + GlStateManager.pushMatrix();; if (mapData == null) { Gui.drawRect(0,0,getFeatureRect().width, getFeatureRect().height, 0xFFFF0000); } else { renderMap(partialTicks,mapProcessor,mapData,context); } - GL11.glPopMatrix(); + GlStateManager.popMatrix(); GL11.glLineWidth(2); RenderUtils.drawUnfilledBox(0,0,getFeatureRect().width, getFeatureRect().height, this.<AColor>getParameter("border_color").getValue().getRGB(), this.<Boolean>getParameter("chromaborder").getValue()); } @@ -142,19 +142,19 @@ public class FeatureDungeonMap extends GuiFeature implements DungeonEndListener, float postScale = this.<Boolean>getParameter("playerCenter").getValue() ? this.<Float>getParameter("postScale").getValue() : 1; int width = getFeatureRect().width; float scale = (this.<Boolean>getParameter("scale").getValue() ? width / 128.0f : 1); - GL11.glTranslated(width / 2, width / 2, 0); - GL11.glScaled(scale, scale, 0); - GL11.glScaled(postScale, postScale,0); + GlStateManager.translate(width / 2, width / 2, 0); + GlStateManager.scale(scale, scale, 0); + GlStateManager.scale(postScale, postScale,0); EntityPlayer p = Minecraft.getMinecraft().thePlayer; Point pt = mapProcessor.worldPointToMapPoint(p.getPositionEyes(partialTicks)); double yaw = p.prevRotationYawHead + (p.rotationYaw - p.prevRotationYawHead) * partialTicks; if (this.<Boolean>getParameter("playerCenter").getValue()) { if (this.<Boolean>getParameter("rotate").getValue()) { - GL11.glRotated((180 - yaw), 0,0,1); + GlStateManager.rotate((float) (180.0 - yaw), 0,0,1); } - GL11.glTranslated( -pt.x, -pt.y, 0); + GlStateManager.translate( -pt.x, -pt.y, 0); } else { - GL11.glTranslated( -64, -64, 0); + GlStateManager.translate( -64, -64, 0); } updateMapTexture(mapData.colors, mapProcessor, context.getDungeonRoomList()); render(mapData, false); @@ -191,7 +191,7 @@ public class FeatureDungeonMap extends GuiFeature implements DungeonEndListener, pt2 = new Point(vec.func_176112_b() /2 + 64, vec.func_176113_c() / 2 + 64); yaw2 = vec.func_176111_d() * 360 / 16.0f + 180; } - GL11.glPushMatrix(); + GlStateManager.pushMatrix(); if (entityplayer == Minecraft.getMinecraft().thePlayer || this.<Boolean>getParameter("showotherplayers").getValue()) { boolean flag1 = entityplayer != null && entityplayer.isWearing(EnumPlayerModelParts.CAPE); @@ -200,32 +200,32 @@ public class FeatureDungeonMap extends GuiFeature implements DungeonEndListener, int l2 = 8 + (flag1 ? 8 : 0); int i3 = 8 * (flag1 ? -1 : 1); - GL11.glTranslated(pt2.x, pt2.y, 0); - GL11.glRotated(yaw2 - 180, 0, 0, 1); + GlStateManager.translate(pt2.x, pt2.y, 0); + GlStateManager.rotate((float) (yaw2 - 180), 0, 0, 1); - GL11.glScaled(1 / scale, 1 / scale, 0); - GL11.glScaled(1 / postScale, 1 / postScale, 0); + GlStateManager.scale(1 / scale, 1 / scale, 0); + GlStateManager.scale(1 / postScale, 1 / postScale, 0); float s = this.<Float>getParameter("playerheadscale").getValue(); - GL11.glScaled(s,s,0); + GlStateManager.scale(s,s,0); Gui.drawScaledCustomSizeModalRect(-4, -4, 8.0F, (float) l2, 8, i3, 8, 8, 64.0F, 64.0F); GL11.glLineWidth(1); RenderUtils.drawUnfilledBox(-4,-4,4, 4, this.<AColor>getParameter("player_color").getValue().getRGB(), this.<Boolean>getParameter("player_chroma").getValue()); } - GL11.glPopMatrix(); + GlStateManager.popMatrix(); } FontRenderer fr = getFontRenderer(); if (this.<Boolean>getParameter("showtotalsecrets").getValue()) { for (DungeonRoom dungeonRoom : context.getDungeonRoomList()) { - GL11.glPushMatrix(); + GlStateManager.pushMatrix(); GlStateManager.pushAttrib(); Point mapPt = mapProcessor.roomPointToMapPoint(dungeonRoom.getUnitPoints().get(0)); - GL11.glTranslated(mapPt.x + mapProcessor.getUnitRoomDimension().width / 2, mapPt.y + mapProcessor.getUnitRoomDimension().height / 2, 0); + GlStateManager.translate(mapPt.x + mapProcessor.getUnitRoomDimension().width / 2, mapPt.y + mapProcessor.getUnitRoomDimension().height / 2, 0); if (this.<Boolean>getParameter("playerCenter").getValue() && this.<Boolean>getParameter("rotate").getValue()) { - GL11.glRotated(yaw - 180, 0, 0, 1); + GlStateManager.rotate((float) (yaw - 180), 0, 0, 1); } - GL11.glScaled(1 / scale, 1 / scale, 0); - GL11.glScaled(1 / postScale, 1 / postScale, 0); + GlStateManager.scale(1 / scale, 1 / scale, 0); + GlStateManager.scale(1 / postScale, 1 / postScale, 0); String str = ""; str += dungeonRoom.getTotalSecrets() == -1 ? "?" : String.valueOf(dungeonRoom.getTotalSecrets()); str += " "; @@ -241,7 +241,7 @@ public class FeatureDungeonMap extends GuiFeature implements DungeonEndListener, fr.drawString(str, -(fr.getStringWidth(str) / 2), -(fr.FONT_HEIGHT / 2), dungeonRoom.getColor() == 74 ? 0xff000000 : 0xFFFFFFFF); GlStateManager.popAttrib(); - GL11.glPopMatrix(); + GlStateManager.popMatrix(); } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonMilestone.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonMilestone.java index c8cff194..05956c3f 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonMilestone.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonMilestone.java @@ -12,6 +12,7 @@ import kr.syeyoung.dungeonsguide.utils.TextUtils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.network.NetworkPlayerInfo; +import net.minecraft.client.renderer.GlStateManager; import net.minecraft.scoreboard.ScorePlayerTeam; import net.minecraft.util.ChatComponentText; import net.minecraftforge.client.event.ClientChatReceivedEvent; @@ -33,7 +34,7 @@ public class FeatureDungeonMilestone extends GuiFeature implements ChatListener if (!skyblockStatus.isOnDungeon()) return; FontRenderer fr = getFontRenderer(); double scale = getFeatureRect().getHeight() / fr.FONT_HEIGHT; - GL11.glScaled(scale, scale, 0); + GlStateManager.scale(scale, scale, 0); for (NetworkPlayerInfo networkPlayerInfoIn : Minecraft.getMinecraft().thePlayer.sendQueue.getPlayerInfoMap()) { String name = networkPlayerInfoIn.getDisplayName() != null ? networkPlayerInfoIn.getDisplayName().getFormattedText() : ScorePlayerTeam.formatPlayerName(networkPlayerInfoIn.getPlayerTeam(), networkPlayerInfoIn.getGameProfile().getName()); if (name.startsWith("§r Milestone: §r")) { @@ -49,7 +50,7 @@ public class FeatureDungeonMilestone extends GuiFeature implements ChatListener public void drawDemo(float partialTicks) { FontRenderer fr = getFontRenderer(); double scale = getFeatureRect().getHeight() / fr.FONT_HEIGHT; - GL11.glScaled(scale, scale, 0); + GlStateManager.scale(scale, scale, 0); fr.drawString("Milestone: 9", 0,0, this.<Color>getParameter("color").getValue().getRGB()); } public static final Pattern milestone_pattern = Pattern.compile("§r§e§l(.+) Milestone §r§e(.)§r§7: .+ §r§a(.+)§r"); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonRealTime.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonRealTime.java index eef21539..0efcd9b4 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonRealTime.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonRealTime.java @@ -10,6 +10,7 @@ import kr.syeyoung.dungeonsguide.features.listener.DungeonStartListener; import kr.syeyoung.dungeonsguide.features.listener.TickListener; import kr.syeyoung.dungeonsguide.utils.TextUtils; import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.renderer.GlStateManager; import net.minecraftforge.client.event.ClientChatReceivedEvent; import org.lwjgl.opengl.GL11; @@ -29,7 +30,7 @@ public class FeatureDungeonRealTime extends GuiFeature implements DungeonStartLi if (started == -1) return; FontRenderer fr = getFontRenderer(); double scale = getFeatureRect().getHeight() / fr.FONT_HEIGHT; - GL11.glScaled(scale, scale, 0); + GlStateManager.scale(scale, scale, 0); fr.drawString("Time(Real): "+TextUtils.formatTime(getTimeElapsed()), 0,0, this.<Color>getParameter("color").getValue().getRGB()); } @@ -41,7 +42,7 @@ public class FeatureDungeonRealTime extends GuiFeature implements DungeonStartLi public void drawDemo(float partialTicks) { FontRenderer fr = getFontRenderer(); double scale = getFeatureRect().getHeight() / fr.FONT_HEIGHT; - GL11.glScaled(scale, scale, 0); + GlStateManager.scale(scale, scale, 0); fr.drawString("Time(Real): -42h", 0,0, this.<Color>getParameter("color").getValue().getRGB()); } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonSBTime.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonSBTime.java index 88236758..6cf8aa29 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonSBTime.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonSBTime.java @@ -9,6 +9,7 @@ import kr.syeyoung.dungeonsguide.features.listener.*; import kr.syeyoung.dungeonsguide.utils.TextUtils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.renderer.GlStateManager; import net.minecraft.scoreboard.Score; import net.minecraft.scoreboard.ScoreObjective; import net.minecraft.scoreboard.ScorePlayerTeam; @@ -33,7 +34,7 @@ public class FeatureDungeonSBTime extends GuiFeature { if (!skyblockStatus.isOnDungeon()) return; FontRenderer fr = getFontRenderer(); double scale = getFeatureRect().getHeight() / fr.FONT_HEIGHT; - GL11.glScaled(scale, scale, 0); + GlStateManager.scale(scale, scale, 0); Scoreboard scoreboard = Minecraft.getMinecraft().theWorld.getScoreboard(); ScoreObjective objective = scoreboard.getObjectiveInDisplaySlot(1); Collection<Score> scores = scoreboard.getSortedScores(objective); @@ -74,7 +75,7 @@ public class FeatureDungeonSBTime extends GuiFeature { public void drawDemo(float partialTicks) { FontRenderer fr = getFontRenderer(); double scale = getFeatureRect().getHeight() / fr.FONT_HEIGHT; - GL11.glScaled(scale, scale, 0); + GlStateManager.scale(scale, scale, 0); fr.drawString("Time(Ig): -42h", 0,0, this.<Color>getParameter("color").getValue().getRGB()); } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonScore.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonScore.java index 880efbaf..788f3207 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonScore.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonScore.java @@ -10,6 +10,7 @@ import kr.syeyoung.dungeonsguide.features.GuiFeature; import lombok.AllArgsConstructor; import lombok.Data; import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.renderer.GlStateManager; import net.minecraft.util.MathHelper; import org.lwjgl.opengl.GL11; @@ -40,7 +41,7 @@ public class FeatureDungeonScore extends GuiFeature { fr.drawString(req, 0, 24, rgb); } else { double scale = getFeatureRect().getHeight() / fr.FONT_HEIGHT; - GL11.glScaled(scale, scale, 0); + GlStateManager.scale(scale, scale, 0); String letter = getLetter(sum); fr.drawString("Score: "+sum + "("+letter+")", 0,0, this.<Color>getParameter("color").getValue().getRGB()); } @@ -57,7 +58,7 @@ public class FeatureDungeonScore extends GuiFeature { fr.drawString("S->S+ (1 Required 1 tomb)", 0, 24, rgb); } else { double scale = getFeatureRect().getHeight() / fr.FONT_HEIGHT; - GL11.glScaled(scale, scale, 0); + GlStateManager.scale(scale, scale, 0); fr.drawString("Score: 305 (S+)", 0,0, this.<Color>getParameter("color").getValue().getRGB()); } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonSecrets.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonSecrets.java index afe8da07..c82669db 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonSecrets.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonSecrets.java @@ -13,6 +13,7 @@ import kr.syeyoung.dungeonsguide.utils.TextUtils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.network.NetworkPlayerInfo; +import net.minecraft.client.renderer.GlStateManager; import net.minecraft.scoreboard.ScorePlayerTeam; import net.minecraft.util.ChatComponentText; import net.minecraftforge.client.event.ClientChatReceivedEvent; @@ -34,7 +35,7 @@ public class FeatureDungeonSecrets extends GuiFeature { if (!skyblockStatus.isOnDungeon()) return; FontRenderer fr = getFontRenderer(); double scale = getFeatureRect().getHeight() / fr.FONT_HEIGHT; - GL11.glScaled(scale, scale, 0); + GlStateManager.scale(scale, scale, 0); fr.drawString("Secrets: "+getSecretsFound() +"/"+getTotalSecrets(), 0,0, this.<Color>getParameter("color").getValue().getRGB()); } @@ -42,7 +43,7 @@ public class FeatureDungeonSecrets extends GuiFeature { public void drawDemo(float partialTicks) { FontRenderer fr = getFontRenderer(); double scale = getFeatureRect().getHeight() / fr.FONT_HEIGHT; - GL11.glScaled(scale, scale, 0); + GlStateManager.scale(scale, scale, 0); fr.drawString("Secrets: 999/2+", 0,0, this.<Color>getParameter("color").getValue().getRGB()); } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonTombs.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonTombs.java index 511e971f..681cfd55 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonTombs.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonTombs.java @@ -8,6 +8,7 @@ import kr.syeyoung.dungeonsguide.utils.TextUtils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.network.NetworkPlayerInfo; +import net.minecraft.client.renderer.GlStateManager; import net.minecraft.scoreboard.ScorePlayerTeam; import org.lwjgl.opengl.GL11; @@ -26,7 +27,7 @@ public class FeatureDungeonTombs extends GuiFeature { if (!skyblockStatus.isOnDungeon()) return; FontRenderer fr = getFontRenderer(); double scale = getFeatureRect().getHeight() / fr.FONT_HEIGHT; - GL11.glScaled(scale, scale, 0); + GlStateManager.scale(scale, scale, 0); fr.drawString("Crypts: "+getTombsFound(), 0,0, this.<Color>getParameter("color").getValue().getRGB()); } @@ -34,7 +35,7 @@ public class FeatureDungeonTombs extends GuiFeature { public void drawDemo(float partialTicks) { FontRenderer fr = getFontRenderer(); double scale = getFeatureRect().getHeight() / fr.FONT_HEIGHT; - GL11.glScaled(scale, scale, 0); + GlStateManager.scale(scale, scale, 0); fr.drawString("Crypts: 42", 0,0, this.<Color>getParameter("color").getValue().getRGB()); } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureWarnLowHealth.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureWarnLowHealth.java index ab3a727d..5c426292 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureWarnLowHealth.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureWarnLowHealth.java @@ -11,6 +11,7 @@ import kr.syeyoung.dungeonsguide.utils.RenderUtils; import kr.syeyoung.dungeonsguide.utils.TextUtils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.item.EntityArmorStand; import net.minecraft.scoreboard.Score; import net.minecraft.scoreboard.ScoreObjective; @@ -39,7 +40,7 @@ public class FeatureWarnLowHealth extends GuiFeature { public void drawDemo(float partialTicks) { FontRenderer fr = getFontRenderer(); double scale = getFeatureRect().getHeight() / fr.FONT_HEIGHT; - GL11.glScaled(scale, scale, 0); + GlStateManager.scale(scale, scale, 0); fr.drawString("DungeonsGuide: ", 0,0,this.<Color>getParameter("color").getValue().getRGB()); fr.drawString("500hp", fr.getStringWidth("DungeonsGuide: "), 0, Color.red.getRGB()); } @@ -48,7 +49,7 @@ public class FeatureWarnLowHealth extends GuiFeature { public void drawHUD(float partialTicks) { FontRenderer fr = getFontRenderer(); double scale = getFeatureRect().getHeight() / fr.FONT_HEIGHT; - GL11.glScaled(scale, scale, 0); + GlStateManager.scale(scale, scale, 0); String lowestHealthName = ""; int lowestHealth = 999999999; Scoreboard scoreboard = Minecraft.getMinecraft().thePlayer.getWorldScoreboard(); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/MPanel.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/MPanel.java index 95410b99..ad350863 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/MPanel.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/MPanel.java @@ -77,8 +77,9 @@ public class MPanel { int relMousex = relMousex0 - getBounds().x; int relMousey = relMousey0 - getBounds().y; - GL11.glTranslated(getBounds().x, getBounds().y, 0); - GL11.glColor4f(1,1,1,0); + GlStateManager.translate(getBounds().x, getBounds().y, 0); + GlStateManager.color(1,1,1,0); + Rectangle absBound = getBounds().getBounds(); absBound.setLocation(absBound.x + parentPoint.x, absBound.y + parentPoint.y); @@ -93,11 +94,11 @@ public class MPanel { GuiScreen.drawRect(0,0, getBounds().width, getBounds().height, backgroundColor.getRGB()); GlStateManager.popAttrib(); - GL11.glPushMatrix(); + GlStateManager.pushMatrix(); GlStateManager.pushAttrib(); render(absMousex, absMousey, relMousex, relMousey, partialTicks, clip); GlStateManager.popAttrib(); - GL11.glPopMatrix(); + GlStateManager.popMatrix(); GL11.glDisable(GL11.GL_SCISSOR_TEST); GL11.glPopAttrib(); @@ -106,11 +107,11 @@ public class MPanel { Point newPt = new Point(parentPoint.x + getBounds().x, parentPoint.y + getBounds().y); for (MPanel mPanel : getChildComponents()){ - GL11.glPushMatrix(); + GlStateManager.pushMatrix(); GlStateManager.pushAttrib(); mPanel.render0(resolution, newPt, clip, absMousex, absMousey, relMousex, relMousey, partialTicks); GlStateManager.popAttrib(); - GL11.glPopMatrix(); + GlStateManager.popMatrix(); } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MTextField.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MTextField.java index 39808808..49c36d3c 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MTextField.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/elements/MTextField.java @@ -64,6 +64,7 @@ public class MTextField extends MPanel { // draw cursor if (cursor != -1) { + if (cursor > text.length()) cursor = text.length(); int x = fr.getStringWidth(text.substring(0, cursor)) - xOffset; cursorBlickTicker++; if (cursorBlickTicker < 10) 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 9d9f3b5c..651a892a 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonAddSet.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonAddSet.java @@ -125,14 +125,18 @@ public class GuiDungeonAddSet extends GuiScreen { @Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); - GL11.glPushMatrix(); + GlStateManager.pushMatrix(); + GlStateManager.pushAttrib(); + GlStateManager.disableDepth(); + GlStateManager.depthMask(false); GlStateManager.disableLighting(); - GlStateManager.disableFog(); + 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(); - GL11.glPopMatrix(); + GlStateManager.popMatrix(); + GlStateManager.popAttrib(); } @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 e704129c..c9bdc050 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonParameterEdit.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonParameterEdit.java @@ -164,14 +164,18 @@ public class GuiDungeonParameterEdit extends GuiScreen { @Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); - GL11.glPushMatrix(); + GlStateManager.pushMatrix(); + GlStateManager.pushAttrib(); + GlStateManager.disableDepth(); + GlStateManager.depthMask(false); GlStateManager.disableLighting(); - GlStateManager.disableFog(); + 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(); - GL11.glPopMatrix(); + GlStateManager.popAttrib(); + GlStateManager.popMatrix(); } @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 4eaeedae..e8c71fe9 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonRoomEdit.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonRoomEdit.java @@ -59,14 +59,18 @@ public class GuiDungeonRoomEdit extends GuiScreen { @Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); - GL11.glPushMatrix(); + GlStateManager.pushMatrix(); + GlStateManager.pushAttrib(); + GlStateManager.disableDepth(); + GlStateManager.depthMask(false); GlStateManager.disableLighting(); - GlStateManager.disableFog(); + 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(); - GL11.glPopMatrix(); + GlStateManager.popAttrib(); + GlStateManager.popMatrix(); } @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 e9e5a60d..50269853 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonValueEdit.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonValueEdit.java @@ -122,14 +122,18 @@ public class GuiDungeonValueEdit extends GuiScreen { public void drawScreen(int mouseX, int mouseY, float partialTicks) { try { ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); - GL11.glPushMatrix(); + GlStateManager.pushMatrix(); + GlStateManager.pushAttrib(); + GlStateManager.disableDepth(); + GlStateManager.depthMask(false); GlStateManager.disableLighting(); - GlStateManager.disableFog(); + 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(); - GL11.glPopMatrix(); + GlStateManager.popAttrib(); + GlStateManager.popMatrix(); } 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 21d0fd9f..13d636ea 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/ActionTreeDisplayPane.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/ActionTreeDisplayPane.java @@ -42,11 +42,11 @@ public class ActionTreeDisplayPane extends MPanel { FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - GL11.glPushMatrix(); - GL11.glTranslated(offsetX, offsetY, 0); - GL11.glScaled(scale,scale,1); + GlStateManager.pushMatrix(); + GlStateManager.translate(offsetX, offsetY, 0); + GlStateManager.scale(scale,scale,1); renderTree(tree, 5, 5, Minecraft.getMinecraft().fontRendererObj, null, new HashMap<ActionTree, Point>()); - GL11.glPopMatrix(); + GlStateManager.popMatrix(); } public int renderTree(ActionTree actionTree, int x, int y, FontRenderer fr, Point drawLineFrom, HashMap<ActionTree, Point> drawmPoints) { @@ -56,23 +56,21 @@ public class ActionTreeDisplayPane extends MPanel { GlStateManager.pushMatrix(); GlStateManager.pushAttrib(); - GL11.glEnable(GL11.GL_BLEND); - GL11.glEnable(GL11.GL_LINE_SMOOTH); - GL11.glDisable(GL11.GL_DEPTH_TEST); - GL11.glDisable(GL11.GL_TEXTURE_2D); - GL11.glBlendFunc(770, 771); - GL11.glEnable(GL11.GL_BLEND); + GlStateManager.enableBlend(); + GlStateManager.disableDepth(); + GlStateManager.disableTexture2D(); + GlStateManager.blendFunc(770, 771); + GlStateManager.enableBlend(); GL11.glLineWidth(1); - GL11.glColor4f(1, 0, 0, 1); + GlStateManager.color(1, 0, 0, 1); GL11.glBegin(2); GL11.glVertex2d(drawLineFrom.x, drawLineFrom.y); GL11.glVertex2d(pt.x, pt.y); GL11.glEnd(); - GL11.glDisable(GL11.GL_BLEND); - GL11.glEnable(GL11.GL_TEXTURE_2D); - GL11.glEnable(GL11.GL_DEPTH_TEST); - GL11.glDisable(GL11.GL_LINE_SMOOTH); - GL11.glDisable(GL11.GL_BLEND); + GlStateManager.disableBlend(); + GlStateManager.enableTexture2D(); + GlStateManager.enableDepth(); + GlStateManager.disableBlend(); GlStateManager.popMatrix(); GlStateManager.popAttrib(); return 0; @@ -83,23 +81,21 @@ public class ActionTreeDisplayPane extends MPanel { GlStateManager.pushMatrix(); GlStateManager.pushAttrib(); - GL11.glEnable(GL11.GL_BLEND); - GL11.glEnable(GL11.GL_LINE_SMOOTH); - GL11.glDisable(GL11.GL_DEPTH_TEST); - GL11.glDisable(GL11.GL_TEXTURE_2D); - GL11.glBlendFunc(770, 771); - GL11.glEnable(GL11.GL_BLEND); + GlStateManager.enableBlend(); + GlStateManager.disableDepth(); + GlStateManager.disableTexture2D(); + GlStateManager.blendFunc(770, 771); + GlStateManager.enableBlend(); GL11.glLineWidth(1); - GL11.glColor4f(1, 1, 1, 1); + GlStateManager.color(1, 1, 1, 1); GL11.glBegin(2); GL11.glVertex2d(drawLineFrom.x, drawLineFrom.y); GL11.glVertex2d(x + dim.width / 2, y); GL11.glEnd(); - GL11.glDisable(GL11.GL_BLEND); - GL11.glEnable(GL11.GL_TEXTURE_2D); - GL11.glEnable(GL11.GL_DEPTH_TEST); - GL11.glDisable(GL11.GL_LINE_SMOOTH); - GL11.glDisable(GL11.GL_BLEND); + GlStateManager.disableBlend(); + GlStateManager.enableTexture2D(); + GlStateManager.enableDepth(); + GlStateManager.disableBlend(); GlStateManager.popMatrix(); GlStateManager.popAttrib(); } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditAColor.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditAColor.java index 1a277cb1..5d63afe1 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditAColor.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditAColor.java @@ -118,7 +118,7 @@ public class ValueEditAColor extends MPanel implements ValueEdit<AColor> { if (hsv[2] < 0) hsv[2] = 0; if (hsv[1] > 1) hsv[1] = 1; if (hsv[1] < 0) hsv[1] = 0; - parameter.setNewData(new AColor(Color.HSBtoRGB(hsv[0], hsv[1], hsv[2]) & 0xffffff | ((int)(alpha * 255)) << 24, true )); + parameter.setNewData(new AColor(Color.HSBtoRGB(hsv[0], hsv[1], hsv[2]) & 0xffffff | (MathHelper.clamp_int((int)(alpha * 255), 0, 255) << 24), true )); h.setData((float) Math.floor(hsv[0] * 360)); s.setData((float) Math.floor(hsv[1] * 100)); v.setData((float) Math.floor(hsv[2] * 100)); @@ -127,6 +127,7 @@ public class ValueEditAColor extends MPanel implements ValueEdit<AColor> { s.updateSelected(); v.updateSelected(); a.updateSelected(); + System.out.println(((AColor)parameter.getNewData()).getAlpha()); } @Override public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) { @@ -135,11 +136,13 @@ public class ValueEditAColor extends MPanel implements ValueEdit<AColor> { Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); int shademodel = GL11.glGetInteger(GL11.GL_SHADE_MODEL); - GL11.glShadeModel(GL11.GL_SMOOTH); - GL11.glEnable(GL11.GL_BLEND); - GL11.glDisable(GL11.GL_TEXTURE_2D); - GL11.glDisable(GL11.GL_CULL_FACE); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + GlStateManager.shadeModel(GL11.GL_SMOOTH); + GlStateManager.enableBlend(); + GlStateManager.disableDepth(); + GlStateManager.disableTexture2D(); + GlStateManager.disableCull();; + GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + // worldrenderer.begin(GL11.GL_TRIANGLES, DefaultVertexFormats.POSITION_COLOR); int rgb = Color.HSBtoRGB(hsv[0], hsv[1], 1); @@ -147,26 +150,26 @@ public class ValueEditAColor extends MPanel implements ValueEdit<AColor> { float g = (rgb >> 8 & 255) / 255.0f; float b = (rgb & 255) / 255.0f; GL11.glBegin(GL11.GL_TRIANGLES); - GL11.glColor4f(0,0,0,alpha);GL11.glVertex3i(25+width ,45, 0); - GL11.glColor4f(0,0,0,alpha);GL11.glVertex3i(10+width , 45, 0); - GL11.glColor4f(r,g,b,alpha);GL11.glVertex3i(25+width , 45+width, 0); + GlStateManager.color(0,0,0,alpha);GL11.glVertex3i(25+width ,45, 0); + GlStateManager.color(0,0,0,alpha);GL11.glVertex3i(10+width , 45, 0); + GlStateManager.color(r,g,b,alpha);GL11.glVertex3i(25+width , 45+width, 0); - GL11.glColor4f(0,0,0,alpha); GL11.glVertex3i(10+width , 45, 0); - GL11.glColor4f(r,g,b,alpha);GL11.glVertex3i(10+width , 45 + width, 0); - GL11.glColor4f(r,g,b,alpha);GL11.glVertex3i(25+width , 45+width, 0); + GlStateManager.color(0,0,0,alpha); GL11.glVertex3i(10+width , 45, 0); + GlStateManager.color(r,g,b,alpha);GL11.glVertex3i(10+width , 45 + width, 0); + GlStateManager.color(r,g,b,alpha);GL11.glVertex3i(25+width , 45+width, 0); GL11.glEnd(); rgb = Color.HSBtoRGB(hsv[0], hsv[1], hsv[2]); r = (rgb >> 16 & 255) / 255.0f; g = (rgb >> 8 & 255) / 255.0f; b = (rgb & 255) / 255.0f; GL11.glBegin(GL11.GL_TRIANGLES); - GL11.glColor4f(r,g,b,0);GL11.glVertex3i(50+width ,45, 0); - GL11.glColor4f(r,g,b,0);GL11.glVertex3i(35+width , 45, 0); - GL11.glColor4f(r,g,b,1);GL11.glVertex3i(50+width , 45+width, 0); + GlStateManager.color(r,g,b,0);GL11.glVertex3i(50+width ,45, 0); + GlStateManager.color(r,g,b,0);GL11.glVertex3i(35+width , 45, 0); + GlStateManager.color(r,g,b,1);GL11.glVertex3i(50+width , 45+width, 0); - GL11.glColor4f(r,g,b,0); GL11.glVertex3i(35+width , 45, 0); - GL11.glColor4f(r,g,b,1);GL11.glVertex3i(35+width , 45 + width, 0); - GL11.glColor4f(r,g,b,1);GL11.glVertex3i(50+width , 45+width, 0); +// GlStateManager.color(r,g,b,0); GL11.glVertex3i(35+width , 45, 0); +// GlStateManager.color(r,g,b,1);GL11.glVertex3i(35+width , 45 + width, 0); +// GlStateManager.color(r,g,b,1);GL11.glVertex3i(50+width , 45+width, 0); GL11.glEnd(); @@ -175,7 +178,7 @@ public class ValueEditAColor extends MPanel implements ValueEdit<AColor> { float cy = 45 + radius; GL11.glBegin(GL11.GL_TRIANGLE_FAN); - GL11.glColor4f(1,1,1,alpha); + GlStateManager.color(1,1,1,alpha); GL11.glVertex3f(cx,cy,0); for (int i = 0; i <= 360; i++) { float rad = 3.141592653f * i / 180; @@ -183,13 +186,13 @@ public class ValueEditAColor extends MPanel implements ValueEdit<AColor> { float r2 = (rgb2 >> 16 & 255) / 255.0f; float g2 = (rgb2 >> 8 & 255) / 255.0f; float b2 = (rgb2 & 255) / 255.0f; - GL11.glColor4f(r2,g2,b2, alpha); + GlStateManager.color(r2,g2,b2, alpha); GL11.glVertex3f(MathHelper.cos(rad) * radius + cx, MathHelper.sin(rad) * radius + cy, 0); } GL11.glEnd(); - GL11.glShadeModel(shademodel); + GlStateManager.shadeModel(shademodel); - GL11.glColor4f(1,1,1,1); + GlStateManager.color(1,1,1,1); worldrenderer.begin(GL11.GL_LINE_LOOP, DefaultVertexFormats.POSITION); float rad2 = 2 * 3.141592653f * hsv[0] ; float x = 5 + radius + (MathHelper.cos(rad2)) * hsv[1] * radius; @@ -210,9 +213,9 @@ public class ValueEditAColor extends MPanel implements ValueEdit<AColor> { worldrenderer.pos(52+width, 45 + (alpha) * width, 0.5).endVertex(); tessellator.draw(); - GL11.glEnable(GL11.GL_TEXTURE_2D); - GL11.glDisable(GL11.GL_BLEND); - GL11.glColor4f(1,1,1,1); + GlStateManager.enableTexture2D(); + GlStateManager.disableBlend(); + GlStateManager.color(1,1,1,1); GlStateManager.color(1,1,1,1); } private int selected = 0; diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditColor.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditColor.java index e4c7d528..6e08bdfe 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditColor.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditColor.java @@ -115,11 +115,11 @@ public class ValueEditColor extends MPanel implements ValueEdit<Color> { Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); int shademodel = GL11.glGetInteger(GL11.GL_SHADE_MODEL); - GL11.glShadeModel(GL11.GL_SMOOTH); - GL11.glEnable(GL11.GL_BLEND); - GL11.glDisable(GL11.GL_TEXTURE_2D); - GL11.glDisable(GL11.GL_CULL_FACE); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + GlStateManager.shadeModel(GL11.GL_SMOOTH); + GlStateManager.enableBlend(); + GlStateManager.disableTexture2D(); + GlStateManager.disableCull(); + GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); // worldrenderer.begin(GL11.GL_TRIANGLES, DefaultVertexFormats.POSITION_COLOR); int rgb = Color.HSBtoRGB(hsv[0], hsv[1], 1); @@ -127,13 +127,13 @@ public class ValueEditColor extends MPanel implements ValueEdit<Color> { float g = (rgb >> 8 & 255) / 255.0f; float b = (rgb & 255) / 255.0f; GL11.glBegin(GL11.GL_TRIANGLES); - GL11.glColor4f(0,0,0,1);GL11.glVertex3i(25+width ,45, 0); - GL11.glColor4f(0,0,0,1);GL11.glVertex3i(10+width , 45, 0); - GL11.glColor4f(r,g,b,1);GL11.glVertex3i(25+width , 45+width, 0); + GlStateManager.color(0,0,0,1);GL11.glVertex3i(25+width ,45, 0); + GlStateManager.color(0,0,0,1);GL11.glVertex3i(10+width , 45, 0); + GlStateManager.color(r,g,b,1);GL11.glVertex3i(25+width , 45+width, 0); - GL11.glColor4f(0,0,0,1); GL11.glVertex3i(10+width , 45, 0); - GL11.glColor4f(r,g,b,1);GL11.glVertex3i(10+width , 45 + width, 0); - GL11.glColor4f(r,g,b,1);GL11.glVertex3i(25+width , 45+width, 0); + GlStateManager.color(0,0,0,1); GL11.glVertex3i(10+width , 45, 0); + GlStateManager.color(r,g,b,1);GL11.glVertex3i(10+width , 45 + width, 0); + GlStateManager.color(r,g,b,1);GL11.glVertex3i(25+width , 45+width, 0); GL11.glEnd(); float radius = width/2f; @@ -141,7 +141,7 @@ public class ValueEditColor extends MPanel implements ValueEdit<Color> { float cy = 45 + radius; GL11.glBegin(GL11.GL_TRIANGLE_FAN); - GL11.glColor4f(1,1,1,1); + GlStateManager.color(1,1,1,1); GL11.glVertex3f(cx,cy,0); for (int i = 0; i <= 360; i++) { float rad = 3.141592653f * i / 180; @@ -149,13 +149,13 @@ public class ValueEditColor extends MPanel implements ValueEdit<Color> { float r2 = (rgb2 >> 16 & 255) / 255.0f; float g2 = (rgb2 >> 8 & 255) / 255.0f; float b2 = (rgb2 & 255) / 255.0f; - GL11.glColor4f(r2,g2,b2, 1); + GlStateManager.color(r2,g2,b2, 1); GL11.glVertex3f(MathHelper.cos(rad) * radius + cx, MathHelper.sin(rad) * radius + cy, 0); } GL11.glEnd(); - GL11.glShadeModel(shademodel); + GlStateManager.shadeModel(shademodel); - GL11.glColor4f(1,1,1,1); + GlStateManager.color(1,1,1,1); worldrenderer.begin(GL11.GL_LINE_LOOP, DefaultVertexFormats.POSITION); float rad2 = 2 * 3.141592653f * hsv[0] ; float x = 5 + radius + (MathHelper.cos(rad2)) * hsv[1] * radius; @@ -171,9 +171,9 @@ public class ValueEditColor extends MPanel implements ValueEdit<Color> { worldrenderer.pos(27+width, 45 + (hsv[2]) * width, 0.5).endVertex(); tessellator.draw(); - GL11.glEnable(GL11.GL_TEXTURE_2D); - GL11.glDisable(GL11.GL_BLEND); - GL11.glColor4f(1,1,1,1); + GlStateManager.enableTexture2D(); + GlStateManager.disableBlend(); + GlStateManager.color(1,1,1,1); GlStateManager.color(1,1,1,1); } private int selected = 0; diff --git a/src/main/java/kr/syeyoung/dungeonsguide/utils/RenderUtils.java b/src/main/java/kr/syeyoung/dungeonsguide/utils/RenderUtils.java index bd2dfbcd..65d2fef3 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/utils/RenderUtils.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/utils/RenderUtils.java @@ -40,6 +40,7 @@ public class RenderUtils { float f = (float)(color >> 16 & 255) / 255.0F; float f1 = (float)(color >> 8 & 255) / 255.0F; float f2 = (float)(color & 255) / 255.0F; + if (!chroma && f3 == 0) return; Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); GlStateManager.enableBlend(); @@ -56,7 +57,7 @@ public class RenderUtils { worldrenderer.begin(GL11.GL_LINE_LOOP, DefaultVertexFormats.POSITION_COLOR); float blah = (System.currentTimeMillis() / 10) % 360; ; - GL11.glShadeModel(GL11.GL_SMOOTH); + GlStateManager.shadeModel(GL11.GL_SMOOTH); color(worldrenderer.pos((double) left, (double) bottom, 0.0D), Color.HSBtoRGB((((blah + 20) % 360) / 360.0f), 1, 1)).endVertex(); color(worldrenderer.pos((double) right, (double) bottom, 0.0D), Color.HSBtoRGB((((blah + 40) % 360) / 360.0f), 1, 1)).endVertex(); color(worldrenderer.pos((double) right, (double) top, 0.0D), Color.HSBtoRGB((((blah + 20) % 360) / 360.0f), 1, 1)).endVertex(); @@ -78,17 +79,17 @@ public class RenderUtils { double playerZ = player.prevPosZ + (player.posZ - player.prevPosZ) * partialTicks; //because of the way 3D rendering is done, all coordinates are relative to the camera. This "resets" the "0,0,0" position to the location that is (0,0,0) in the world. - GL11.glPushAttrib(GL11.GL_ENABLE_BIT); - GL11.glPushMatrix(); - GL11.glTranslated(-playerX, -playerY, -playerZ); - GL11.glDisable(GL11.GL_TEXTURE_2D); - GL11.glDisable(GL11.GL_CULL_FACE); + GlStateManager.pushAttrib(); + GlStateManager.pushMatrix(); + GlStateManager.translate(-playerX, -playerY, -playerZ); + GlStateManager.disableTexture2D(); + GlStateManager.disableCull(); GlStateManager.enableAlpha(); if (dungeonDoor.isExist()) - GL11.glColor4ub((byte)0,(byte)255,(byte)0, (byte)255); + GlStateManager.color(0,1,0,1); else - GL11.glColor4ub((byte)255,(byte)0,(byte)0, (byte)255); + GlStateManager.color(1,0,0,1); double x = dungeonDoor.getPosition().getX() + 0.5; double y = dungeonDoor.getPosition().getY() -0.99; @@ -105,7 +106,7 @@ public class RenderUtils { if (dungeonDoor.isExist()) { GL11.glBegin(GL11.GL_QUADS); - GL11.glColor4ub((byte)0,(byte)0,(byte)255, (byte)255); + GlStateManager.color(0,0,1,1); if (dungeonDoor.isZDir()) { GL11.glVertex3d(x - 0.5, y + 0.1, z - 2.5); GL11.glVertex3d(x - 0.5, y+ 0.1, z + 2.5); @@ -138,11 +139,11 @@ public class RenderUtils { // GlStateManager.disableAlpha(); GlStateManager.disableBlend(); - GL11.glEnable(GL11.GL_TEXTURE_2D); - GL11.glEnable(GL11.GL_CULL_FACE); + GlStateManager.enableTexture2D(); + GlStateManager.enableCull(); - GL11.glPopAttrib(); - GL11.glPopMatrix(); + GlStateManager.popAttrib(); + GlStateManager.popMatrix(); } @@ -158,8 +159,8 @@ public class RenderUtils { GlStateManager.translate(-realX, -realY, -realZ); GlStateManager.disableTexture2D(); if (!depth) { - GL11.glDisable(GL11.GL_DEPTH_TEST); - GL11.glDepthMask(false); + GlStateManager.disableDepth(); + GlStateManager.depthMask(false); } GlStateManager.enableBlend(); GlStateManager.disableAlpha(); @@ -175,8 +176,8 @@ public class RenderUtils { GlStateManager.translate(realX, realY, realZ); GlStateManager.disableBlend(); if (!depth) { - GL11.glEnable(GL11.GL_DEPTH_TEST); - GL11.glDepthMask(true); + GlStateManager.enableDepth(); + GlStateManager.depthMask(true); } GlStateManager.enableAlpha(); GlStateManager.enableTexture2D(); @@ -198,8 +199,8 @@ public class RenderUtils { GlStateManager.enableBlend(); GlStateManager.disableAlpha(); if (!depth) { - GL11.glDisable(GL11.GL_DEPTH_TEST); - GL11.glDepthMask(false); + GlStateManager.disableDepth(); + GlStateManager.depthMask(false); } GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); GL11.glLineWidth(2); @@ -215,8 +216,8 @@ public class RenderUtils { GlStateManager.enableAlpha(); GlStateManager.enableTexture2D(); if (!depth) { - GL11.glEnable(GL11.GL_DEPTH_TEST); - GL11.glDepthMask(true); + GlStateManager.enableDepth(); + GlStateManager.depthMask(true); } GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.popMatrix(); @@ -242,12 +243,12 @@ public class RenderUtils { GlStateManager.disableTexture2D(); if (!depth) { - GL11.glDisable(GL11.GL_DEPTH_TEST); - GL11.glDepthMask(false); + GlStateManager.disableDepth(); + GlStateManager.depthMask(false); } - GL11.glColor4ub((byte)c.getRed(), (byte)c.getGreen(), (byte)c.getBlue(), (byte)c.getAlpha()); + GlStateManager.color(c.getRed() /255.0f, c.getGreen() / 255.0f, c.getBlue()/ 255.0f, c.getAlpha()/ 255.0f); - GL11.glTranslated(blockpos.getX(), blockpos.getY(), blockpos.getZ()); + GlStateManager.translate(blockpos.getX(), blockpos.getY(), blockpos.getZ()); GL11.glBegin(GL11.GL_QUADS); GL11.glVertex3d(0, 0, 0); @@ -286,8 +287,8 @@ public class RenderUtils { if (!depth) { - GL11.glDisable(GL11.GL_DEPTH_TEST); - GL11.glDepthMask(true); + GlStateManager.disableDepth(); + GlStateManager.depthMask(true); } GlStateManager.enableTexture2D(); GlStateManager.disableBlend(); @@ -317,13 +318,13 @@ public class RenderUtils { GlStateManager.disableTexture2D(); if (!depth) { - GL11.glDisable(GL11.GL_DEPTH_TEST); - GL11.glDepthMask(false); + GlStateManager.disableDepth(); + GlStateManager.depthMask(false); } - GL11.glColor4ub((byte)c.getRed(), (byte)c.getGreen(), (byte)c.getBlue(), (byte)c.getAlpha()); + GlStateManager.color(c.getRed()/ 255.0f, c.getGreen()/ 255.0f, c.getBlue()/ 255.0f, c.getAlpha()/ 255.0f); AxisAlignedBB axisAlignedBB = AxisAlignedBB.fromBounds(-0.4,-1.5,-0.4,0.4,0,0.4); - GL11.glTranslated(-0.4 + entity.posX, -1.5 + entity.posY, -0.4 + entity.posZ); + GlStateManager.translate(-0.4 + entity.posX, -1.5 + entity.posY, -0.4 + entity.posZ); double x = 0.8; double y = 1.5; @@ -365,8 +366,8 @@ public class RenderUtils { if (!depth) { - GL11.glDisable(GL11.GL_DEPTH_TEST); - GL11.glDepthMask(true); + GlStateManager.disableDepth(); + GlStateManager.depthMask(true); } GlStateManager.enableTexture2D(); GlStateManager.disableBlend(); @@ -392,17 +393,17 @@ public class RenderUtils { lScale *= 0.45f * multiplier; } - GL11.glColor4f(1f, 1f, 1f, 0.5f); - GL11.glPushMatrix(); - GL11.glTranslatef(renderPos.x, renderPos.y, renderPos.z); - GL11.glRotatef(-renderManager.playerViewY, 0.0f, 1.0f, 0.0f); - GL11.glRotatef(renderManager.playerViewX, 1.0f, 0.0f, 0.0f); - GL11.glScalef(-lScale, -lScale, lScale); - GL11.glDisable(GL11.GL_LIGHTING); - GL11.glDepthMask(false); - GL11.glDisable(GL11.GL_DEPTH_TEST); - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + GlStateManager.color(1f, 1f, 1f, 0.5f); + GlStateManager.pushMatrix(); + GlStateManager.translate(renderPos.x, renderPos.y, renderPos.z); + GlStateManager.rotate(-renderManager.playerViewY, 0.0f, 1.0f, 0.0f); + GlStateManager.rotate(renderManager.playerViewX, 1.0f, 0.0f, 0.0f); + GlStateManager.scale(-lScale, -lScale, lScale); + GlStateManager.disableLighting(); + GlStateManager.depthMask(false); + GlStateManager.disableDepth(); + GlStateManager.enableBlend(); + GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); int textWidth = fontRenderer.getStringWidth(text); @@ -422,10 +423,10 @@ public class RenderUtils { fontRenderer.drawString(text, -textWidth / 2, 0, color); - GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); - GL11.glDepthMask(true); - GL11.glEnable(GL11.GL_DEPTH_TEST); - GL11.glPopMatrix(); + GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f); + GlStateManager.depthMask(true); + GlStateManager.enableDepth(); + GlStateManager.popMatrix(); } private static Vector3f getRenderPos(float x, float y, float z, float partialTicks) { |