From 29883f9da7d79af34d5c4513678d75d626a7709b Mon Sep 17 00:00:00 2001 From: syeyoung Date: Wed, 28 Apr 2021 18:17:46 +0900 Subject: ok done --- .../party/playerpreview/DataRendererRegistry.java | 4 +- .../party/playerpreview/DataRendererSetUrOwn.java | 44 ++++++++++++++++++++++ .../playerpreview/FeatureViewPlayerOnJoin.java | 5 ++- .../kr/syeyoung/dungeonsguide/utils/XPUtils.java | 31 +++++++++++---- 4 files changed, 74 insertions(+), 10 deletions(-) create mode 100644 src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererSetUrOwn.java (limited to 'src') 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 4a97bd3c..92f9ffdd 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 @@ -34,6 +34,8 @@ public class DataRendererRegistry { } dataRendererMap.put("dungeon_"+value.getJsonName()+"_higheststat", new DataRenderDungeonHighestFloorStat(value)); } - dataRendererMap.put("fairyouls", new DataRendererFairySouls()); + dataRendererMap.put("fairysouls", new DataRendererFairySouls()); + + dataRendererMap.put("dummy", new DataRendererSetUrOwn()); } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererSetUrOwn.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererSetUrOwn.java new file mode 100644 index 00000000..3601768d --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererSetUrOwn.java @@ -0,0 +1,44 @@ +package kr.syeyoung.dungeonsguide.features.impl.party.playerpreview; + +import kr.syeyoung.dungeonsguide.config.guiconfig.FeatureEditPane; +import kr.syeyoung.dungeonsguide.features.impl.party.api.ClassSpecificData; +import kr.syeyoung.dungeonsguide.features.impl.party.api.PlayerProfile; +import kr.syeyoung.dungeonsguide.utils.RenderUtils; +import kr.syeyoung.dungeonsguide.utils.TextUtils; +import kr.syeyoung.dungeonsguide.utils.XPUtils; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; + +import java.awt.*; +import java.util.Arrays; + +public class DataRendererSetUrOwn implements DataRenderer { + @Override + public Dimension renderData(PlayerProfile playerProfile) { + FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; + fr.drawString("§aCustomize at /dg", 0,0,-1); + fr.drawString("§a-> Party Kicker", 0,fr.FONT_HEIGHT,-1); + fr.drawString("§a-> View Player Stats", 0,fr.FONT_HEIGHT*2,-1); + fr.drawString("§a-> Edit", 0,fr.FONT_HEIGHT*3,-1); + return new Dimension(100, fr.FONT_HEIGHT*4); + } + + @Override + public void onHover(PlayerProfile playerProfile, int mouseX, int mouseY) { + + } + + @Override + public Dimension renderDummy() { + FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; + fr.drawString("§aCustomize at /dg", 0,0,-1); + fr.drawString("§a-> Party Kicker", 0,fr.FONT_HEIGHT,-1); + fr.drawString("§a-> View Player Stats", 0,fr.FONT_HEIGHT*2,-1); + fr.drawString("§a-> Edit", 0,fr.FONT_HEIGHT*3,-1); + return new Dimension(100, fr.FONT_HEIGHT*4); + } + @Override + public Dimension getDimension() { + return new Dimension(100, Minecraft.getMinecraft().fontRendererObj.FONT_HEIGHT*4); + } +} 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 b2596f63..be0349c9 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 @@ -59,7 +59,9 @@ public class FeatureViewPlayerOnJoin extends SimpleFeature implements GuiPostRen public FeatureViewPlayerOnJoin() { super("Party Kicker", "View player stats when join", "view player rendering when joining/someone joins the party", "partykicker.viewstats", true); - this.parameters.put("datarenderers", new FeatureParameter>("datarenderers", "DataRenderers","Datarenderssdasd", new ArrayList<>(), "stringlist")); + this.parameters.put("datarenderers", new FeatureParameter>("datarenderers", "DataRenderers","Datarenderssdasd", new ArrayList<>(Arrays.asList( + "catalv", "selected_class_lv", "dungeon_catacombs_higheststat", "dungeon_master_catacombs_higheststat", "skill_combat_lv", "skill_foraging_lv", "skill_mining_lv", "fairysouls", "dummy" + )), "stringlist")); } private Rectangle popupRect; @@ -192,6 +194,7 @@ public class FeatureViewPlayerOnJoin extends SimpleFeature implements GuiPostRen GlStateManager.translate(95, 5, 0); int culmutativeY = 5; DataRenderer dataRendererToHover = null; + System.out.println(this.>getParameter("datarenderers").getValue()); for (String datarenderers : this.>getParameter("datarenderers").getValue()) { DataRenderer dataRenderer = DataRendererRegistry.getDataRenderer(datarenderers); Dimension dim; diff --git a/src/main/java/kr/syeyoung/dungeonsguide/utils/XPUtils.java b/src/main/java/kr/syeyoung/dungeonsguide/utils/XPUtils.java index 9ac8ef09..ed23cd7e 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/utils/XPUtils.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/utils/XPUtils.java @@ -160,8 +160,13 @@ public class XPUtils { public static XPCalcResult getCataXp(double totalXp) { Map.Entry totalXpEn = catacombXp.floorEntry(totalXp); XPCalcResult xpCalcResult = new XPCalcResult(); - xpCalcResult.level = totalXpEn.getValue(); - xpCalcResult.remainingXp = totalXp - totalXpEn.getKey(); + if (totalXpEn == null) { + xpCalcResult.setLevel(0); + xpCalcResult.remainingXp = totalXp; + } else { + xpCalcResult.level = totalXpEn.getValue(); + xpCalcResult.remainingXp = totalXp - totalXpEn.getKey(); + } Map.Entry asdasd = catacombXp.ceilingEntry(totalXp); xpCalcResult.nextLvXp = asdasd == null ? 0 : asdasd.getKey(); return xpCalcResult; @@ -171,17 +176,27 @@ public class XPUtils { case RUNECRAFTING: Map.Entry totalXpEn = skillXp2.floorEntry(totalXp); XPCalcResult xpCalcResult = new XPCalcResult(); - xpCalcResult.level = totalXpEn.getValue(); - xpCalcResult.remainingXp = totalXp - totalXpEn.getKey(); - Map.Entry asdasd = skillXp2.ceilingEntry(totalXp); + if (totalXpEn == null) { + xpCalcResult.setLevel(0); + xpCalcResult.remainingXp = totalXp; + } else { + xpCalcResult.level = totalXpEn.getValue(); + xpCalcResult.remainingXp = totalXp - totalXpEn.getKey(); + } + Map.Entry asdasd = catacombXp.ceilingEntry(totalXp); xpCalcResult.nextLvXp = asdasd == null ? 0 : asdasd.getKey(); return xpCalcResult; default: totalXpEn = skillXp.floorEntry(totalXp); xpCalcResult = new XPCalcResult(); - xpCalcResult.level = totalXpEn.getValue(); - xpCalcResult.remainingXp = totalXp - totalXpEn.getKey(); - asdasd = skillXp.ceilingEntry(totalXp); + if (totalXpEn == null) { + xpCalcResult.setLevel(0); + xpCalcResult.remainingXp = totalXp; + } else { + xpCalcResult.level = totalXpEn.getValue(); + xpCalcResult.remainingXp = totalXp - totalXpEn.getKey(); + } + asdasd = catacombXp.ceilingEntry(totalXp); xpCalcResult.nextLvXp = asdasd == null ? 0 : asdasd.getKey(); return xpCalcResult; } -- cgit