From 6e94888aa5c45783a5f35ac03e53deaecafb3be5 Mon Sep 17 00:00:00 2001 From: DoKM Date: Tue, 27 Jul 2021 09:41:52 +0200 Subject: Add a hotfix setting to disable the negative cape/disable all capes --- .../notenoughupdates/cosmetics/CapeManager.java | 13 +++-- .../notenoughupdates/cosmetics/NEUCape.java | 60 +++++++++++++--------- .../notenoughupdates/options/NEUConfig.java | 3 ++ 3 files changed, 50 insertions(+), 26 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 893a1109..9ed24d9a 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java @@ -137,6 +137,7 @@ public class CapeManager { } private void updateCapes() { + NotEnoughUpdates.INSTANCE.manager.hypixelApi.getMyApiAsync("activecapes.json", (jsonObject) -> { if(jsonObject.get("success").getAsBoolean()) { lastJsonSync = jsonObject; @@ -203,7 +204,9 @@ public class CapeManager { if(none) { localCape = null; } else { - localCape = new MutablePair<>(new NEUCape(capename), capename); + if (!NotEnoughUpdates.INSTANCE.config.hidden.disableAllCapes) { + localCape = new MutablePair<>(new NEUCape(capename), capename); + } } } else if(capeMap.containsKey(playerUUID)) { if(none) { @@ -213,7 +216,9 @@ public class CapeManager { capePair.setValue(capename); } } else if(!none) { - capeMap.put(playerUUID, new MutablePair<>(new NEUCape(capename), capename)); + if (!NotEnoughUpdates.INSTANCE.config.hidden.disableAllCapes){ + capeMap.put(playerUUID, new MutablePair<>(new NEUCape(capename), capename)); + } } } @@ -287,7 +292,9 @@ public class CapeManager { String selCape = NotEnoughUpdates.INSTANCE.config.hidden.selectedCape; if(selCape != null && !selCape.isEmpty()) { if(localCape == null) { - localCape = new MutablePair<>(new NEUCape(selCape), selCape); + if (!NotEnoughUpdates.INSTANCE.config.hidden.disableAllCapes) { + localCape = new MutablePair<>(new NEUCape(selCape), selCape); + } } else { localCape.setValue(selCape); } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/NEUCape.java b/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/NEUCape.java index c1d36e8f..77dee6e5 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/NEUCape.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/NEUCape.java @@ -1,5 +1,6 @@ package io.github.moulberry.notenoughupdates.cosmetics; +import io.github.moulberry.notenoughupdates.NotEnoughUpdates; import io.github.moulberry.notenoughupdates.core.util.lerp.LerpUtils; import io.github.moulberry.notenoughupdates.util.ReverseWorldRenderer; import io.github.moulberry.notenoughupdates.util.TexLoc; @@ -79,32 +80,45 @@ public class NEUCape { public void setCapeTexture(String capeName) { if(this.capeName != null && this.capeName.equalsIgnoreCase(capeName)) return; - this.capeName = capeName; startTime = System.currentTimeMillis(); + boolean defaultBehaviour = true; - if(capeName.equalsIgnoreCase("fade")) { - shaderName = "fade_cape"; - } else if(capeName.equalsIgnoreCase("space")) { - shaderName = "space_cape"; - } else if(capeName.equalsIgnoreCase("mcworld") || capeName.equalsIgnoreCase("skyclient")) { - shaderName = "mcworld_cape"; - } else if(capeName.equalsIgnoreCase("lava")) { - shaderName = "lava_cape"; - } else if(capeName.equalsIgnoreCase("lightning")) { - shaderName = "lightning_cape"; - } else if(capeName.equalsIgnoreCase("thebakery")) { - shaderName = "biscuit_cape"; - } else if(capeName.equalsIgnoreCase("negative")) { - shaderName = "negative"; - } else if(capeName.equalsIgnoreCase("void")) { - shaderName = "void"; - } else if(capeName.equalsIgnoreCase("tunnel")) { - shaderName = "tunnel"; - } else if(capeName.equalsIgnoreCase("planets")) { - shaderName = "planets"; - } else { - shaderName = "shiny_cape"; + if(NotEnoughUpdates.INSTANCE.config.hidden.disableBrokenCapes){ + if(capeName.equals("negative")){ + defaultBehaviour = false; + this.capeName = "fade"; + this.shaderName = "fade_cape"; + } + } + if(defaultBehaviour){ + this.capeName = capeName; + + + + if (capeName.equalsIgnoreCase("fade")) { + shaderName = "fade_cape"; + } else if (capeName.equalsIgnoreCase("space")) { + shaderName = "space_cape"; + } else if (capeName.equalsIgnoreCase("mcworld") || capeName.equalsIgnoreCase("skyclient")) { + shaderName = "mcworld_cape"; + } else if (capeName.equalsIgnoreCase("lava")) { + shaderName = "lava_cape"; + } else if (capeName.equalsIgnoreCase("lightning")) { + shaderName = "lightning_cape"; + } else if (capeName.equalsIgnoreCase("thebakery")) { + shaderName = "biscuit_cape"; + } else if (capeName.equalsIgnoreCase("negative")) { + shaderName = "negative"; + } else if (capeName.equalsIgnoreCase("void")) { + shaderName = "void"; + } else if (capeName.equalsIgnoreCase("tunnel")) { + shaderName = "tunnel"; + } else if (capeName.equalsIgnoreCase("planets")) { + shaderName = "planets"; + } else { + shaderName = "shiny_cape"; + } } ResourceLocation staticCapeTex = new ResourceLocation("notenoughupdates:capes/" + capeName + ".png"); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java index 22d5e32f..48b7ff46 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java @@ -286,6 +286,9 @@ public class NEUConfig extends Config { "Looting:\u003e:3:5:0"); @Expose public String repoURL = "https://github.com/Moulberry/NotEnoughUpdates-REPO/archive/master.zip"; @Expose public String repoCommitsURL = "https://api.github.com/repos/Moulberry/NotEnoughUpdates-REPO/commits/master"; + //These config options were added due to a graphical bug that caused the player to be unable to see the screen + @Expose public boolean disableBrokenCapes = false; + @Expose public boolean disableAllCapes = false; } private static ArrayList createDefaultQuickCommands() { -- cgit