diff options
author | syeyoung <cyong06@naver.com> | 2021-05-01 01:00:18 +0900 |
---|---|---|
committer | syeyoung <cyong06@naver.com> | 2021-05-01 01:00:18 +0900 |
commit | 3759d01a54ede59da360961266c7b3cd70c99585 (patch) | |
tree | 640d9b0eb81a1ebb2d6bd3d1edfed3b09bbf18ae | |
parent | 29883f9da7d79af34d5c4513678d75d626a7709b (diff) | |
download | Skyblock-Dungeons-Guide-3759d01a54ede59da360961266c7b3cd70c99585.tar.gz Skyblock-Dungeons-Guide-3759d01a54ede59da360961266c7b3cd70c99585.tar.bz2 Skyblock-Dungeons-Guide-3759d01a54ede59da360961266c7b3cd70c99585.zip |
render util best
18 files changed, 188 insertions, 102 deletions
diff --git a/build.gradle b/build.gradle index 37d6059a..b571e637 100755 --- a/build.gradle +++ b/build.gradle @@ -75,6 +75,7 @@ dependencies { // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html // http://www.gradle.org/docs/current/userguide/dependency_management.html compileOnly 'org.projectlombok:lombok:1.18.16' + compileOnly files('mods/Hychat-1.12.1-BETA.jar') annotationProcessor 'org.projectlombok:lombok:1.18.16' testCompileOnly 'org.projectlombok:lombok:1.18.16' diff --git a/options.txt b/options.txt index 1b8c369a..0fb8aaae 100755 --- a/options.txt +++ b/options.txt @@ -116,7 +116,7 @@ key_Flip (Hold):0 key_Rotate (Hold):0 key_Flip (Toggle):0 key_Rotate (Toggle):0 -soundCategory_master:0.0 +soundCategory_master:1.0 soundCategory_music:0.0 soundCategory_record:1.0 soundCategory_weather:1.0 diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/FeatureEditPane.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/FeatureEditPane.java index 4173b2ac..0ab6761f 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/FeatureEditPane.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/FeatureEditPane.java @@ -94,98 +94,7 @@ public class FeatureEditPane extends MPanel { super.render0(resolution, parentPoint, parentClip, absMousex, absMousey, relMousex0, relMousey0, partialTicks); } - private static float zLevel = 0; - public static void drawHoveringText(List<String> textLines, int x, int y, FontRenderer font) - { - if (!textLines.isEmpty()) - { - GlStateManager.disableRescaleNormal(); - RenderHelper.disableStandardItemLighting(); - GlStateManager.disableLighting(); - GlStateManager.disableDepth(); - int i = 0; - - for (String s : textLines) - { - int j = font.getStringWidth(s); - - if (j > i) - { - i = j; - } - } - - int l1 = x + 12; - int i2 = y - 12; - int k = 8; - if (textLines.size() > 1) - { - k += 2 + (textLines.size() - 1) * 10; - } - - zLevel = 300.0F; - int l = -267386864; - drawGradientRect(l1 - 3, i2 - 4, l1 + i + 3, i2 - 3, l, l); - drawGradientRect(l1 - 3, i2 + k + 3, l1 + i + 3, i2 + k + 4, l, l); - drawGradientRect(l1 - 3, i2 - 3, l1 + i + 3, i2 + k + 3, l, l); - drawGradientRect(l1 - 4, i2 - 3, l1 - 3, i2 + k + 3, l, l); - drawGradientRect(l1 + i + 3, i2 - 3, l1 + i + 4, i2 + k + 3, l, l); - int i1 = 1347420415; - int j1 = (i1 & 16711422) >> 1 | i1 & -16777216; - drawGradientRect(l1 - 3, i2 - 3 + 1, l1 - 3 + 1, i2 + k + 3 - 1, i1, j1); - drawGradientRect(l1 + i + 2, i2 - 3 + 1, l1 + i + 3, i2 + k + 3 - 1, i1, j1); - drawGradientRect(l1 - 3, i2 - 3, l1 + i + 3, i2 - 3 + 1, i1, i1); - drawGradientRect(l1 - 3, i2 + k + 2, l1 + i + 3, i2 + k + 3, j1, j1); - - for (int k1 = 0; k1 < textLines.size(); ++k1) - { - String s1 = (String)textLines.get(k1); - font.drawStringWithShadow(s1, (float)l1, (float)i2, -1); - - if (k1 == 0) - { - i2 += 2; - } - - i2 += 10; - } - - zLevel = 0.0F; - GlStateManager.enableLighting(); - GlStateManager.enableDepth(); - RenderHelper.enableStandardItemLighting(); - GlStateManager.enableRescaleNormal(); - } - } - protected static void drawGradientRect(int left, int top, int right, int bottom, int startColor, int endColor) - { - float f = (float)(startColor >> 24 & 255) / 255.0F; - float f1 = (float)(startColor >> 16 & 255) / 255.0F; - float f2 = (float)(startColor >> 8 & 255) / 255.0F; - float f3 = (float)(startColor & 255) / 255.0F; - float f4 = (float)(endColor >> 24 & 255) / 255.0F; - float f5 = (float)(endColor >> 16 & 255) / 255.0F; - float f6 = (float)(endColor >> 8 & 255) / 255.0F; - float f7 = (float)(endColor & 255) / 255.0F; - GlStateManager.disableTexture2D(); - GlStateManager.enableBlend(); - GlStateManager.disableAlpha(); - GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); - GlStateManager.shadeModel(7425); - Tessellator tessellator = Tessellator.getInstance(); - WorldRenderer worldrenderer = tessellator.getWorldRenderer(); - worldrenderer.begin(7, DefaultVertexFormats.POSITION_COLOR); - worldrenderer.pos((double)right, (double)top, (double)zLevel).color(f1, f2, f3, f).endVertex(); - worldrenderer.pos((double)left, (double)top, (double)zLevel).color(f1, f2, f3, f).endVertex(); - worldrenderer.pos((double)left, (double)bottom, (double)zLevel).color(f5, f6, f7, f4).endVertex(); - worldrenderer.pos((double)right, (double)bottom, (double)zLevel).color(f5, f6, f7, f4).endVertex(); - tessellator.draw(); - GlStateManager.shadeModel(7424); - GlStateManager.disableBlend(); - GlStateManager.enableAlpha(); - GlStateManager.enableTexture2D(); - } @Override public void mouseScrolled(int absMouseX, int absMouseY, int relMouseX0, int relMouseY0, int scrollAmount) { diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/PanelDefaultParameterConfig.java b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/PanelDefaultParameterConfig.java index d0d1e984..75b6e881 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/PanelDefaultParameterConfig.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/config/guiconfig/PanelDefaultParameterConfig.java @@ -4,6 +4,7 @@ import kr.syeyoung.dungeonsguide.features.AbstractFeature; import kr.syeyoung.dungeonsguide.features.FeatureParameter; import kr.syeyoung.dungeonsguide.gui.MPanel; import kr.syeyoung.dungeonsguide.gui.elements.MButton; +import kr.syeyoung.dungeonsguide.utils.RenderUtils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.ScaledResolution; @@ -62,7 +63,7 @@ public class PanelDefaultParameterConfig extends MPanel { if (within instanceof MParameter) { FeatureParameter feature = ((MParameter) within).getParameter(); GL11.glDisable(GL11.GL_SCISSOR_TEST); - FeatureEditPane.drawHoveringText(new ArrayList<String>(Arrays.asList(feature.getDescription().split("\n"))), relMousex0,relMousey0, Minecraft.getMinecraft().fontRendererObj); + RenderUtils.drawHoveringText(new ArrayList<String>(Arrays.asList(feature.getDescription().split("\n"))), relMousex0,relMousey0, Minecraft.getMinecraft().fontRendererObj); GL11.glEnable(GL11.GL_SCISSOR_TEST); } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/api/ApiFetchur.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/api/ApiFetchur.java index 2c22b94a..16ae4e0f 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/api/ApiFetchur.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/api/ApiFetchur.java @@ -253,8 +253,19 @@ public class ApiFetchur { } if (profile == null) return Optional.empty(); + PlayerProfile pp = parseProfile(profile, dashTrimmed); + json = getJson("https://api.hypixel.net/player?uuid="+uid+"&key="+apiKey); + if (json.has("player")) { + JsonObject treasures = json.getAsJsonObject("player"); + if (treasures.has("achievements")) { + treasures = treasures.getAsJsonObject("achievements"); + if (treasures.has("skyblock_treasure_hunter")) { + pp.setTotalSecrets(treasures.get("skyblock_treasure_hunter").getAsInt()); + } + } + } - return Optional.of(parseProfile(profile, dashTrimmed)); + return Optional.of(pp); } public static int getOrDefault(JsonObject jsonObject, String key, int value) { diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/api/PlayerProfile.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/api/PlayerProfile.java index 7cc38a3e..c1bdbc09 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/api/PlayerProfile.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/api/PlayerProfile.java @@ -27,6 +27,8 @@ public class PlayerProfile { private ItemStack[] enderchest; private ItemStack[] talismans; + private int totalSecrets; + @Data public static class Armor { private final ItemStack[] armorSlots = new ItemStack[4]; diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRenderDungeonFloorStat.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRenderDungeonFloorStat.java index a1c4410b..249e43c6 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRenderDungeonFloorStat.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRenderDungeonFloorStat.java @@ -2,6 +2,7 @@ package kr.syeyoung.dungeonsguide.features.impl.party.playerpreview; import kr.syeyoung.dungeonsguide.config.guiconfig.FeatureEditPane; import kr.syeyoung.dungeonsguide.features.impl.party.api.*; +import kr.syeyoung.dungeonsguide.utils.RenderUtils; import kr.syeyoung.dungeonsguide.utils.TextUtils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; @@ -64,7 +65,7 @@ public class DataRenderDungeonFloorStat implements DataRenderer { if (playedFloorFloorSpecificData == null) return; String floorName = (dungeonType == DungeonType.CATACOMBS ? "F" : "M") + floor; - FeatureEditPane.drawHoveringText(Arrays.asList( + RenderUtils.drawHoveringText(Arrays.asList( "§bFloor "+floorName, "§bBest Score§7: §f"+playedFloorFloorSpecificData.getData().getBestScore(), "§bTotal Completions§7: §f"+playedFloorFloorSpecificData.getData().getCompletions(), diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRenderDungeonHighestFloorStat.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRenderDungeonHighestFloorStat.java index cc27bb70..561da4e4 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRenderDungeonHighestFloorStat.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRenderDungeonHighestFloorStat.java @@ -2,6 +2,7 @@ package kr.syeyoung.dungeonsguide.features.impl.party.playerpreview; import kr.syeyoung.dungeonsguide.config.guiconfig.FeatureEditPane; import kr.syeyoung.dungeonsguide.features.impl.party.api.*; +import kr.syeyoung.dungeonsguide.utils.RenderUtils; import kr.syeyoung.dungeonsguide.utils.TextUtils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; @@ -66,7 +67,7 @@ public class DataRenderDungeonHighestFloorStat implements DataRenderer { if (playedFloorFloorSpecificData == null) return; String floorName = (dungeonType == DungeonType.CATACOMBS ? "F" : "M") + dungeonStatDungeonSpecificData.getData().getHighestCompleted(); - FeatureEditPane.drawHoveringText(Arrays.asList( + RenderUtils.drawHoveringText(Arrays.asList( "§bFloor "+floorName, "§bBest Score§7: §f"+playedFloorFloorSpecificData.getData().getBestScore(), "§bTotal Completions§7: §f"+playedFloorFloorSpecificData.getData().getCompletions(), diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererClassLv.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererClassLv.java index 63de1db4..950ddbe9 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererClassLv.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererClassLv.java @@ -59,6 +59,6 @@ public class DataRendererClassLv implements DataRenderer { ClassSpecificData<PlayerProfile.PlayerClassData> dungeonStatDungeonSpecificData = playerProfile.getPlayerClassData().get(dungeonClass); if (dungeonStatDungeonSpecificData == null) return; XPUtils.XPCalcResult xpCalcResult = XPUtils.getCataXp(dungeonStatDungeonSpecificData.getData().getExperience()); - FeatureEditPane.drawHoveringText(Arrays.asList("§bCurrent Lv§7: §e"+xpCalcResult.getLevel(),"§bExp§7: §e"+ TextUtils.format((long)xpCalcResult.getRemainingXp()) + "§7/§e"+TextUtils.format((long)xpCalcResult.getNextLvXp()), "§bTotal Xp§7: §e"+ TextUtils.format((long)dungeonStatDungeonSpecificData.getData().getExperience())),mouseX, mouseY, Minecraft.getMinecraft().fontRendererObj); + RenderUtils.drawHoveringText(Arrays.asList("§bCurrent Lv§7: §e"+xpCalcResult.getLevel(),"§bExp§7: §e"+ TextUtils.format((long)xpCalcResult.getRemainingXp()) + "§7/§e"+TextUtils.format((long)xpCalcResult.getNextLvXp()), "§bTotal Xp§7: §e"+ TextUtils.format((long)dungeonStatDungeonSpecificData.getData().getExperience())),mouseX, mouseY, Minecraft.getMinecraft().fontRendererObj); } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererDungeonLv.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererDungeonLv.java index 6c76d860..580b1761 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererDungeonLv.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererDungeonLv.java @@ -55,6 +55,6 @@ public class DataRendererDungeonLv implements DataRenderer { DungeonSpecificData<DungeonStat> dungeonStatDungeonSpecificData = playerProfile.getDungeonStats().get(dungeonType); if (dungeonStatDungeonSpecificData == null) return; XPUtils.XPCalcResult xpCalcResult = XPUtils.getCataXp(dungeonStatDungeonSpecificData.getData().getExperience()); - FeatureEditPane.drawHoveringText(Arrays.asList("§bCurrent Lv§7: §e"+xpCalcResult.getLevel(),"§bExp§7: §e"+TextUtils.format((long)xpCalcResult.getRemainingXp()) + "§7/§e"+TextUtils.format((long)xpCalcResult.getNextLvXp()), "§bTotal Xp§7: §e"+ TextUtils.format((long)dungeonStatDungeonSpecificData.getData().getExperience())),mouseX, mouseY, Minecraft.getMinecraft().fontRendererObj); + RenderUtils.drawHoveringText(Arrays.asList("§bCurrent Lv§7: §e"+xpCalcResult.getLevel(),"§bExp§7: §e"+TextUtils.format((long)xpCalcResult.getRemainingXp()) + "§7/§e"+TextUtils.format((long)xpCalcResult.getNextLvXp()), "§bTotal Xp§7: §e"+ TextUtils.format((long)dungeonStatDungeonSpecificData.getData().getExperience())),mouseX, mouseY, Minecraft.getMinecraft().fontRendererObj); } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererHoverForInv.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererHoverForInv.java new file mode 100644 index 00000000..6360da62 --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererHoverForInv.java @@ -0,0 +1,32 @@ +package kr.syeyoung.dungeonsguide.features.impl.party.playerpreview; + +import kr.syeyoung.dungeonsguide.features.impl.party.api.PlayerProfile; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; + +import java.awt.*; + +public class DataRendererHoverForInv implements DataRenderer { + @Override + public Dimension renderData(PlayerProfile playerProfile) { + FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; + fr.drawString("§aView Inventory", 0,0,-1); + return new Dimension(100, fr.FONT_HEIGHT); + } + + @Override + public void onHover(PlayerProfile playerProfile, int mouseX, int mouseY) { + + } + + @Override + public Dimension renderDummy() { + FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; + fr.drawString("§aView Inventory", 0,0,-1); + return new Dimension(100, fr.FONT_HEIGHT); + } + @Override + public Dimension getDimension() { + return new Dimension(100, Minecraft.getMinecraft().fontRendererObj.FONT_HEIGHT); + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererRegistry.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererRegistry.java index 92f9ffdd..fa23d1e7 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererRegistry.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererRegistry.java @@ -35,6 +35,8 @@ public class DataRendererRegistry { dataRendererMap.put("dungeon_"+value.getJsonName()+"_higheststat", new DataRenderDungeonHighestFloorStat(value)); } dataRendererMap.put("fairysouls", new DataRendererFairySouls()); + dataRendererMap.put("secrets", new DataRendererSecrets()); + dataRendererMap.put("hover4inv", new DataRendererHoverForInv()); dataRendererMap.put("dummy", new DataRendererSetUrOwn()); } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererSecrets.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererSecrets.java new file mode 100644 index 00000000..73426287 --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererSecrets.java @@ -0,0 +1,31 @@ +package kr.syeyoung.dungeonsguide.features.impl.party.playerpreview; + +import kr.syeyoung.dungeonsguide.features.impl.party.api.PlayerProfile; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; + +import java.awt.*; + +public class DataRendererSecrets implements DataRenderer { + @Override + public Dimension renderData(PlayerProfile playerProfile) { + FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; + fr.drawString("§eSecrets §b"+playerProfile.getTotalSecrets(), 0,0,-1); + return new Dimension(100, fr.FONT_HEIGHT); + } + + @Override + public Dimension renderDummy() { + FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; + fr.drawString("§eSecrets §b99999", 0,0,-1); + return new Dimension(100, fr.FONT_HEIGHT); + } + @Override + public Dimension getDimension() { + return new Dimension(100, Minecraft.getMinecraft().fontRendererObj.FONT_HEIGHT); + } + + @Override + public void onHover(PlayerProfile playerProfile, int mouseX, int mouseY) { + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererSelectedClassLv.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererSelectedClassLv.java index 35478c5a..95295fd5 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererSelectedClassLv.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererSelectedClassLv.java @@ -51,6 +51,6 @@ public class DataRendererSelectedClassLv implements DataRenderer { ClassSpecificData<PlayerProfile.PlayerClassData> dungeonStatDungeonSpecificData = playerProfile.getPlayerClassData().get(playerProfile.getSelectedClass()); if (dungeonStatDungeonSpecificData == null) return; XPUtils.XPCalcResult xpCalcResult = XPUtils.getCataXp(dungeonStatDungeonSpecificData.getData().getExperience()); - FeatureEditPane.drawHoveringText(Arrays.asList("§bCurrent Lv§7: §e"+xpCalcResult.getLevel(),"§bExp§7: §e"+ TextUtils.format((long)xpCalcResult.getRemainingXp()) + "§7/§e"+TextUtils.format((long)xpCalcResult.getNextLvXp()), "§bTotal Xp§7: §e"+ TextUtils.format((long)dungeonStatDungeonSpecificData.getData().getExperience())),mouseX, mouseY, Minecraft.getMinecraft().fontRendererObj); + RenderUtils.drawHoveringText(Arrays.asList("§bCurrent Lv§7: §e"+xpCalcResult.getLevel(),"§bExp§7: §e"+ TextUtils.format((long)xpCalcResult.getRemainingXp()) + "§7/§e"+TextUtils.format((long)xpCalcResult.getNextLvXp()), "§bTotal Xp§7: §e"+ TextUtils.format((long)dungeonStatDungeonSpecificData.getData().getExperience())),mouseX, mouseY, Minecraft.getMinecraft().fontRendererObj); } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererSkillLv.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererSkillLv.java index ebd42cb8..81f4c59a 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererSkillLv.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererSkillLv.java @@ -55,6 +55,6 @@ public class DataRendererSkillLv implements DataRenderer { Double xp = playerProfile.getSkillXp().get(skill); if (xp == null) return; XPUtils.XPCalcResult xpCalcResult = XPUtils.getSkillXp(skill, xp); - FeatureEditPane.drawHoveringText(Arrays.asList("§bCurrent Lv§7: §e"+xpCalcResult.getLevel(),"§bExp§7: §e"+ TextUtils.format((long)xpCalcResult.getRemainingXp()) + "§7/§e"+TextUtils.format((long)xpCalcResult.getNextLvXp()), "§bTotal Xp§7: §e"+ TextUtils.format(xp.longValue())),mouseX, mouseY, Minecraft.getMinecraft().fontRendererObj); + RenderUtils.drawHoveringText(Arrays.asList("§bCurrent Lv§7: §e"+xpCalcResult.getLevel(),"§bExp§7: §e"+ TextUtils.format((long)xpCalcResult.getRemainingXp()) + "§7/§e"+TextUtils.format((long)xpCalcResult.getNextLvXp()), "§bTotal Xp§7: §e"+ TextUtils.format(xp.longValue())),mouseX, mouseY, Minecraft.getMinecraft().fontRendererObj); } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/FeatureViewPlayerOnJoin.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/FeatureViewPlayerOnJoin.java index be0349c9..80109141 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/FeatureViewPlayerOnJoin.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/FeatureViewPlayerOnJoin.java @@ -21,6 +21,7 @@ import kr.syeyoung.dungeonsguide.features.text.PanelTextParameterConfig; import kr.syeyoung.dungeonsguide.features.text.TextHUDFeature; import kr.syeyoung.dungeonsguide.gui.MPanel; import kr.syeyoung.dungeonsguide.party.PartyManager; +import kr.syeyoung.dungeonsguide.utils.RenderUtils; import kr.syeyoung.dungeonsguide.utils.TextUtils; import kr.syeyoung.dungeonsguide.utils.XPUtils; import lombok.Getter; @@ -253,7 +254,7 @@ public class FeatureViewPlayerOnJoin extends SimpleFeature implements GuiPostRen GL11.glDisable(GL11.GL_SCISSOR_TEST); FontRenderer theRenderer = (font == null ? fr : font); int minY = scaledResolution.getScaledHeight() - (list.size()+4) * theRenderer.FONT_HEIGHT - popupRect.y; - FeatureEditPane.drawHoveringText(list,relX, Math.min(minY, relY), theRenderer); + RenderUtils.drawHoveringText(list,relX, Math.min(minY, relY), theRenderer); GL11.glEnable(GL11.GL_SCISSOR_TEST); } } else { @@ -319,6 +320,7 @@ public class FeatureViewPlayerOnJoin extends SimpleFeature implements GuiPostRen @Override public void onChat(ClientChatReceivedEvent clientChatReceivedEvent) { + if (!isEnabled()) return; String str = clientChatReceivedEvent.message.getFormattedText(); if (str.contains("§r§ejoined the dungeon group! (§r§b")) { String username = TextUtils.stripColor(str).split(" ")[3]; 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 67d90b36..d8463ad9 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/RoomMatchDisplayPane.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/RoomMatchDisplayPane.java @@ -84,7 +84,7 @@ public class RoomMatchDisplayPane extends MPanel { fr.drawString("N", x *16 +10 + offsetX, z *16 +10 + offsetY,0xFFFF0000); } if (z == hoverY && x == hoverX) { - FeatureEditPane.drawHoveringText(Arrays.asList(new String[] {"Expected "+data2 +" But found "+data1}), relMousex0, relMousey0, fr); + RenderUtils.drawHoveringText(Arrays.asList(new String[] {"Expected "+data2 +" But found "+data1}), relMousex0, relMousey0, fr); } } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/utils/RenderUtils.java b/src/main/java/kr/syeyoung/dungeonsguide/utils/RenderUtils.java index 72f5f793..9accdbbe 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/utils/RenderUtils.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/utils/RenderUtils.java @@ -7,6 +7,7 @@ import net.minecraft.client.entity.EntityOtherPlayerMP; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.renderer.entity.RenderManager; @@ -27,6 +28,98 @@ public class RenderUtils { public static void drawTexturedRect(float x, float y, float width, float height, int filter) { drawTexturedRect(x, y, width, height, 0.0F, 1.0F, 0.0F, 1.0F, filter); } + private static float zLevel = 0; + public static void drawHoveringText(List<String> textLines, int x, int y, FontRenderer font) + { + if (!textLines.isEmpty()) + { + GlStateManager.disableRescaleNormal(); + RenderHelper.disableStandardItemLighting(); + GlStateManager.disableLighting(); + GlStateManager.disableDepth(); + int i = 0; + + for (String s : textLines) + { + int j = font.getStringWidth(s); + + if (j > i) + { + i = j; + } + } + + int l1 = x + 12; + int i2 = y - 12; + int k = 8; + + if (textLines.size() > 1) + { + k += 2 + (textLines.size() - 1) * 10; + } + + zLevel = 300.0F; + int l = -267386864; + drawGradientRect(l1 - 3, i2 - 4, l1 + i + 3, i2 - 3, l, l); + drawGradientRect(l1 - 3, i2 + k + 3, l1 + i + 3, i2 + k + 4, l, l); + drawGradientRect(l1 - 3, i2 - 3, l1 + i + 3, i2 + k + 3, l, l); + drawGradientRect(l1 - 4, i2 - 3, l1 - 3, i2 + k + 3, l, l); + drawGradientRect(l1 + i + 3, i2 - 3, l1 + i + 4, i2 + k + 3, l, l); + int i1 = 1347420415; + int j1 = (i1 & 16711422) >> 1 | i1 & -16777216; + drawGradientRect(l1 - 3, i2 - 3 + 1, l1 - 3 + 1, i2 + k + 3 - 1, i1, j1); + drawGradientRect(l1 + i + 2, i2 - 3 + 1, l1 + i + 3, i2 + k + 3 - 1, i1, j1); + drawGradientRect(l1 - 3, i2 - 3, l1 + i + 3, i2 - 3 + 1, i1, i1); + drawGradientRect(l1 - 3, i2 + k + 2, l1 + i + 3, i2 + k + 3, j1, j1); + + for (int k1 = 0; k1 < textLines.size(); ++k1) + { + String s1 = (String)textLines.get(k1); + font.drawStringWithShadow(s1, (float)l1, (float)i2, -1); + + if (k1 == 0) + { + i2 += 2; + } + + i2 += 10; + } + + zLevel = 0.0F; + GlStateManager.enableLighting(); + GlStateManager.enableDepth(); + RenderHelper.enableStandardItemLighting(); + GlStateManager.enableRescaleNormal(); + } + } + protected static void drawGradientRect(int left, int top, int right, int bottom, int startColor, int endColor) + { + float f = (float)(startColor >> 24 & 255) / 255.0F; + float f1 = (float)(startColor >> 16 & 255) / 255.0F; + float f2 = (float)(startColor >> 8 & 255) / 255.0F; + float f3 = (float)(startColor & 255) / 255.0F; + float f4 = (float)(endColor >> 24 & 255) / 255.0F; + float f5 = (float)(endColor >> 16 & 255) / 255.0F; + float f6 = (float)(endColor >> 8 & 255) / 255.0F; + float f7 = (float)(endColor & 255) / 255.0F; + GlStateManager.disableTexture2D(); + GlStateManager.enableBlend(); + GlStateManager.disableAlpha(); + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + GlStateManager.shadeModel(7425); + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + worldrenderer.begin(7, DefaultVertexFormats.POSITION_COLOR); + worldrenderer.pos((double)right, (double)top, (double)zLevel).color(f1, f2, f3, f).endVertex(); + worldrenderer.pos((double)left, (double)top, (double)zLevel).color(f1, f2, f3, f).endVertex(); + worldrenderer.pos((double)left, (double)bottom, (double)zLevel).color(f5, f6, f7, f4).endVertex(); + worldrenderer.pos((double)right, (double)bottom, (double)zLevel).color(f5, f6, f7, f4).endVertex(); + tessellator.draw(); + GlStateManager.shadeModel(7424); + GlStateManager.disableBlend(); + GlStateManager.enableAlpha(); + GlStateManager.enableTexture2D(); + } public static void drawTexturedRect(float x, float y, float width, float height, float uMin, float uMax, float vMin, float vMax, int filter) { GlStateManager.enableTexture2D(); GlStateManager.enableBlend(); |