diff options
author | NopoTheGamer <40329022+NopoTheGamer@users.noreply.github.com> | 2024-05-11 22:51:26 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-11 14:51:26 +0200 |
commit | 20c515c9baed83384fbedabb6a581400a4a7c1ef (patch) | |
tree | 5cfff8a11c41de5fa7ac84e1f30abe6439e003e9 | |
parent | 565cdc350660c48abea450a029ed785a076ec486 (diff) | |
download | NotEnoughUpdates-20c515c9baed83384fbedabb6a581400a4a7c1ef.tar.gz NotEnoughUpdates-20c515c9baed83384fbedabb6a581400a4a7c1ef.tar.bz2 NotEnoughUpdates-20c515c9baed83384fbedabb6a581400a4a7c1ef.zip |
Fix local capes not updating if you didnt have a cape equiped before (#1151)
-rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java b/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java index 5ed915d0..589542d5 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java @@ -301,21 +301,19 @@ public class CapeManager { if (event.player == null) return; String uuid = event.player.getUniqueID().toString().replace("-", ""); - if (!capeMap.containsKey(uuid)) return; - + boolean isLocalPlayer = event.player == Minecraft.getMinecraft().thePlayer; boolean hasLocalCape = localCape != null && localCape.getRight() != null && !localCape.getRight().equals("null"); + if (!capeMap.containsKey(uuid) && !(hasLocalCape && isLocalPlayer)) return; try { Pair<NEUCape, String> entry = capeMap.get(uuid); - String capeName = entry.getRight(); - if (capeName != null && !capeName.equals("null")) { - if (event.player == Minecraft.getMinecraft().thePlayer && hasLocalCape) { - localCape.getLeft().setCapeTexture(localCape.getValue()); - CAPE_TICKER.submit(() -> localCape.getLeft().onTick(event.player)); - } else { - entry.getLeft().setCapeTexture(capeName); - CAPE_TICKER.submit(() -> capeMap.get(uuid).getLeft().onTick(event.player)); - } + String capeName = entry == null ? null : entry.getRight(); + if (isLocalPlayer && hasLocalCape) { + localCape.getLeft().setCapeTexture(localCape.getValue()); + CAPE_TICKER.submit(() -> localCape.getLeft().onTick(event.player)); + } else if (capeName != null && !capeName.equals("null")) { + entry.getLeft().setCapeTexture(capeName); + CAPE_TICKER.submit(() -> capeMap.get(uuid).getLeft().onTick(event.player)); } else { capeMap.remove(uuid); } |