From f3248605aac0973e144d52c6b9dc7742d7e1f358 Mon Sep 17 00:00:00 2001 From: syeyoung Date: Wed, 13 Oct 2021 23:02:53 +0900 Subject: - Fix Talisman/Weight renderer throwing error --- .../features/impl/party/playerpreview/DataRendererLilyWeight.java | 6 +++++- .../features/impl/party/playerpreview/DataRendererTalismans.java | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'src/main/java/kr/syeyoung/dungeonsguide/features') diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererLilyWeight.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererLilyWeight.java index a97ebae3..fa9ecf65 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererLilyWeight.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererLilyWeight.java @@ -33,7 +33,10 @@ public class DataRendererLilyWeight implements DataRenderer { @Override public Dimension renderData(PlayerProfile playerProfile) { FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - fr.drawString("§eLily Weight §b"+String.format("%.3f", playerProfile.getLilyWeight().getTotal()), 0,0,-1); + if (playerProfile.getLilyWeight() == null) + fr.drawString("§eLily Weight §cAPI DISABLED", 0,0,-1); + else + fr.drawString("§eLily Weight §b"+String.format("%.3f", playerProfile.getLilyWeight().getTotal()), 0,0,-1); return new Dimension(100, fr.FONT_HEIGHT); } @@ -51,6 +54,7 @@ public class DataRendererLilyWeight implements DataRenderer { @Override public void onHover(PlayerProfile playerProfile, int mouseX, int mouseY) { PlayerProfile.LilyWeight lilyWeight= playerProfile.getLilyWeight(); + if (lilyWeight == null) return; ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); GuiUtils.drawHoveringText(Arrays.asList( "§bDungeon Weights§7: §e"+ String.format("%.3f",lilyWeight.getCatacombs_base()+lilyWeight.getCatacombs_master()+lilyWeight.getCatacombs_exp()), diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererTalismans.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererTalismans.java index 2112362f..db17322d 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererTalismans.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/playerpreview/DataRendererTalismans.java @@ -37,7 +37,8 @@ import java.util.List; public class DataRendererTalismans implements DataRenderer { @Override public Dimension renderData(PlayerProfile playerProfile) { - if (!playerProfile.getAdditionalProperties().containsKey("talismanCnt")) { + boolean apiDisabled = playerProfile.getTalismans() == null || playerProfile.getInventory() == null; + if (!playerProfile.getAdditionalProperties().containsKey("talismanCnt") && !apiDisabled) { int[] cnts = new int[Rarity.values().length]; for (ItemStack talisman : playerProfile.getTalismans()) { if (talisman == null) continue; @@ -58,6 +59,9 @@ public class DataRendererTalismans implements DataRenderer { } FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; + if (apiDisabled) + fr.drawString("§eTalis §cAPI DISABLED", 0,0,-1); + else fr.drawString("§eTalis §f"+str, 0,0,-1); return new Dimension(100, fr.FONT_HEIGHT); } -- cgit