diff options
author | syeyoung <cyong06@naver.com> | 2021-01-04 21:45:04 +0900 |
---|---|---|
committer | syeyoung <cyong06@naver.com> | 2021-01-04 21:45:04 +0900 |
commit | 04d414547e4d932f4db9a74dbc4aea8d75b96960 (patch) | |
tree | acfccab2803dc6161e4ce099021d2fa972967ace /src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonTombs.java | |
parent | ece0af65a8bba6c722ac6f0853c570d2e8cad784 (diff) | |
download | Skyblock-Dungeons-Guide-04d414547e4d932f4db9a74dbc4aea8d75b96960.tar.gz Skyblock-Dungeons-Guide-04d414547e4d932f4db9a74dbc4aea8d75b96960.tar.bz2 Skyblock-Dungeons-Guide-04d414547e4d932f4db9a74dbc4aea8d75b96960.zip |
Various things
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonTombs.java')
-rw-r--r-- | src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonTombs.java | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonTombs.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonTombs.java new file mode 100644 index 00000000..511e971f --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonTombs.java @@ -0,0 +1,50 @@ +package kr.syeyoung.dungeonsguide.features.impl; + +import kr.syeyoung.dungeonsguide.SkyblockStatus; +import kr.syeyoung.dungeonsguide.e; +import kr.syeyoung.dungeonsguide.features.FeatureParameter; +import kr.syeyoung.dungeonsguide.features.GuiFeature; +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.scoreboard.ScorePlayerTeam; +import org.lwjgl.opengl.GL11; + +import java.awt.*; + +public class FeatureDungeonTombs extends GuiFeature { + public FeatureDungeonTombs() { + super("Dungeon", "Display #Crypts", "Display how much total crypts have been blown up in a dungeon run", "dungeon.stats.tombs", true, getFontRenderer().getStringWidth("Crypts: 42"), getFontRenderer().FONT_HEIGHT); + this.setEnabled(false); + parameters.put("color", new FeatureParameter<Color>("color", "Color", "Color of text", Color.orange, "color")); + } + + SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); + @Override + public void drawHUD(float partialTicks) { + if (!skyblockStatus.isOnDungeon()) return; + FontRenderer fr = getFontRenderer(); + double scale = getFeatureRect().getHeight() / fr.FONT_HEIGHT; + GL11.glScaled(scale, scale, 0); + fr.drawString("Crypts: "+getTombsFound(), 0,0, this.<Color>getParameter("color").getValue().getRGB()); + } + + @Override + public void drawDemo(float partialTicks) { + FontRenderer fr = getFontRenderer(); + double scale = getFeatureRect().getHeight() / fr.FONT_HEIGHT; + GL11.glScaled(scale, scale, 0); + fr.drawString("Crypts: 42", 0,0, this.<Color>getParameter("color").getValue().getRGB()); + } + + public int getTombsFound() { + 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 Crypts: §r§6")) { + return Integer.parseInt(TextUtils.stripColor(name).substring(9)); + } + } + return 0; + } +} |