aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsyeyoung <cyong06@naver.com>2021-08-22 17:29:57 +0900
committersyeyoung <cyong06@naver.com>2021-08-22 17:29:57 +0900
commit690584b06c6cb22b88e5927860957d7604b636eb (patch)
tree4aad4209baf3cb8e7a249b5127acb22080a2fcea
parent8e786d35bfa4bbf990acb2fcde292113b0c68c3b (diff)
downloadSkyblock-Dungeons-Guide-690584b06c6cb22b88e5927860957d7604b636eb.tar.gz
Skyblock-Dungeons-Guide-690584b06c6cb22b88e5927860957d7604b636eb.tar.bz2
Skyblock-Dungeons-Guide-690584b06c6cb22b88e5927860957d7604b636eb.zip
- Profile viewer now shows API Disabled
- Fix Selected Class LV Showing incorrect progressbar
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/api/ApiFetchur.java7
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/api/PlayerProfile.java2
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererSelectedClassLv.java2
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererSkillLv.java2
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/FeatureViewPlayerOnJoin.java64
5 files changed, 43 insertions, 34 deletions
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 283de978..d5843e7b 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
@@ -302,6 +302,10 @@ public class ApiFetchur {
if (jsonObject == null || !jsonObject.has(key) || jsonObject.get(key) instanceof JsonNull) return value;
return jsonObject.get(key).getAsString();
}
+ public static Double getOrDefaultNullable(JsonObject jsonObject, String key, Double value) {
+ if (jsonObject == null || !jsonObject.has(key) || jsonObject.get(key) instanceof JsonNull) return value;
+ return jsonObject.get(key).getAsDouble();
+ }
public static NBTTagCompound parseBase64NBT(String nbt) throws IOException {
return CompressedStreamTools.readCompressed(new ByteArrayInputStream(Base64.getDecoder().decode(nbt)));
}
@@ -376,8 +380,9 @@ public class ApiFetchur {
}
}
+ playerProfile.setSkillXp(new HashMap<>());
for (Skill value : Skill.values()) {
- playerProfile.getSkillXp().put(value, getOrDefault(playerData, "experience_skill_"+value.getJsonName(), 0.0));
+ playerProfile.getSkillXp().put(value, getOrDefaultNullable(playerData, "experience_skill_"+value.getJsonName(), null));
}
if (playerData.has("pets")) {
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 4cadd188..0bb441d2 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
@@ -66,7 +66,7 @@ public class PlayerProfile {
private double experience;
}
- private Map<Skill, Double> skillXp = new HashMap<>();
+ private Map<Skill, Double> skillXp;
private List<Pet> pets = new ArrayList<>();
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 db09d941..94bc3542 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
@@ -44,7 +44,7 @@ public class DataRendererSelectedClassLv implements DataRenderer {
fr.drawString(xpCalcResult.getLevel()+"", fr.getStringWidth(playerProfile.getSelectedClass().getFamilarName()+" "),0,0xFFFFFFFF);
fr.drawString("★", fr.getStringWidth(playerProfile.getSelectedClass().getFamilarName()+" "+xpCalcResult.getLevel()+" "),0,0xFFAAAAAA);
- RenderUtils.renderBar(0, fr.FONT_HEIGHT, 100,xpCalcResult.getRemainingXp() == 0 ? 1 : (float) (xpCalcResult.getNextLvXp() / xpCalcResult.getRemainingXp()));
+ RenderUtils.renderBar(0, fr.FONT_HEIGHT, 100,xpCalcResult.getRemainingXp() == 0 ? 1 : (float) (xpCalcResult.getRemainingXp() / xpCalcResult.getNextLvXp()));
}
return new Dimension(100, fr.FONT_HEIGHT*2);
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 12867cd6..58fbb782 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
@@ -42,7 +42,7 @@ public class DataRendererSkillLv implements DataRenderer {
Double xp = playerProfile.getSkillXp().get(skill);
if (xp == null) {
fr.drawString(skill.getFriendlyName(), 0,0, 0xFF55ffff);
- fr.drawString("Unknown", fr.getStringWidth(skill.getFriendlyName()+" "),0,0xFFFFFFFF);
+ fr.drawString("§cSkill API Disabled", 0, fr.FONT_HEIGHT,0xFFFFFFFF);
} else {
XPUtils.XPCalcResult xpCalcResult = XPUtils.getSkillXp(skill, xp);
fr.drawString(skill.getFriendlyName(), 0,0, 0xFF55ffff);
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 c438e889..21fb5d04 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
@@ -337,7 +337,7 @@ public class FeatureViewPlayerOnJoin extends SimpleFeature implements GuiPostRen
GlStateManager.pushMatrix();
GlStateManager.translate(popupRect.x, popupRect.y, 0);
- if (drawInv && playerProfile.get().getInventory() != null) {
+ if (drawInv) {
int startX = 81;
int startY = 86;
clip(scaledResolution, popupRect.x+startX-1, popupRect.y+startY-1, 164, 74);
@@ -348,41 +348,45 @@ public class FeatureViewPlayerOnJoin extends SimpleFeature implements GuiPostRen
int rx = relX - startX;
int ry = relY - startY;
+ if (playerProfile.get().getInventory() != null) {
+ GlStateManager.disableRescaleNormal();
+ RenderHelper.enableGUIStandardItemLighting();
+ GlStateManager.disableLighting();
+ for (int i = 0; i < playerProfile.get().getInventory().length; i++) {
+ int x = (i%9) * 18;
+ int y = (i/9) * 18;
+ if (x <= rx && rx<x+18 && y<=ry&&ry<y+18) {
+ toHover = playerProfile.get().getInventory()[(i+9) % 36];
+ }
+ Gui.drawRect(x,y,x+18,y+18, 0xFF000000);
+ Gui.drawRect(x+1,y+1,x+17,y+17, 0xFF666666);
+ GlStateManager.color(1, 1, 1, 1.0F);
-
- GlStateManager.disableRescaleNormal();
- RenderHelper.enableGUIStandardItemLighting();
- GlStateManager.disableLighting();
- for (int i = 0; i < playerProfile.get().getInventory().length; i++) {
- int x = (i%9) * 18;
- int y = (i/9) * 18;
- if (x <= rx && rx<x+18 && y<=ry&&ry<y+18) {
- toHover = playerProfile.get().getInventory()[(i+9) % 36];
+ Minecraft.getMinecraft().getRenderItem().renderItemAndEffectIntoGUI(playerProfile.get().getInventory()[(i+9) % 36], (i%9) * 18+1,(i/9) * 18+1);
}
- Gui.drawRect(x,y,x+18,y+18, 0xFF000000);
- Gui.drawRect(x+1,y+1,x+17,y+17, 0xFF666666);
- GlStateManager.color(1, 1, 1, 1.0F);
- Minecraft.getMinecraft().getRenderItem().renderItemAndEffectIntoGUI(playerProfile.get().getInventory()[(i+9) % 36], (i%9) * 18+1,(i/9) * 18+1);
- }
-
- if (toHover != null) {
- List<String> list = toHover.getTooltip(Minecraft.getMinecraft().thePlayer, Minecraft.getMinecraft().gameSettings.advancedItemTooltips);
- for (int i = 0; i < list.size(); ++i) {
- if (i == 0) {
- list.set(i, toHover.getRarity().rarityColor + list.get(i));
- } else {
- list.set(i, EnumChatFormatting.GRAY + list.get(i));
+ if (toHover != null) {
+ List<String> list = toHover.getTooltip(Minecraft.getMinecraft().thePlayer, Minecraft.getMinecraft().gameSettings.advancedItemTooltips);
+ for (int i = 0; i < list.size(); ++i) {
+ if (i == 0) {
+ list.set(i, toHover.getRarity().rarityColor + list.get(i));
+ } else {
+ list.set(i, EnumChatFormatting.GRAY + list.get(i));
+ }
}
+ FontRenderer font = toHover.getItem().getFontRenderer(toHover);
+ GlStateManager.popMatrix();
+ GL11.glDisable(GL11.GL_SCISSOR_TEST);
+ FontRenderer theRenderer = (font == null ? fr : font);
+ GuiUtils.drawHoveringText(list,mouseX, mouseY, scaledResolution.getScaledWidth(), scaledResolution.getScaledHeight(), -1, theRenderer);
+ GL11.glEnable(GL11.GL_SCISSOR_TEST);
+ GlStateManager.pushMatrix();
}
- FontRenderer font = toHover.getItem().getFontRenderer(toHover);
- GlStateManager.popMatrix();
- GL11.glDisable(GL11.GL_SCISSOR_TEST);
- FontRenderer theRenderer = (font == null ? fr : font);
- GuiUtils.drawHoveringText(list,mouseX, mouseY, scaledResolution.getScaledWidth(), scaledResolution.getScaledHeight(), -1, theRenderer);
- GL11.glEnable(GL11.GL_SCISSOR_TEST);
- GlStateManager.pushMatrix();
+ } else {
+ Gui.drawRect(0,0,162,72, 0xFF666666);
+ fr.drawSplitString("Player has disabled Inventory API", 5,5, 142, -1);
}
+
}
GL11.glDisable(GL11.GL_SCISSOR_TEST);