diff options
author | Lulonaut <lulonaut@tutanota.de> | 2022-12-07 03:49:13 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-07 13:49:13 +1100 |
commit | 200549b4255c50dfaf55fc46e0e08bdfd672435a (patch) | |
tree | 4a565ddd8fbd1b5889393eeaad9859c9b3e8ce3a | |
parent | dccf7ee3c7797b92360a91f5bc34d99ef997d0bd (diff) | |
download | NotEnoughUpdates-200549b4255c50dfaf55fc46e0e08bdfd672435a.tar.gz NotEnoughUpdates-200549b4255c50dfaf55fc46e0e08bdfd672435a.tar.bz2 NotEnoughUpdates-200549b4255c50dfaf55fc46e0e08bdfd672435a.zip |
Disable wither cloak overlay when creepers are gone (#473)
3 files changed, 20 insertions, 0 deletions
diff --git a/Update Notes/2.1.1.md b/Update Notes/2.1.1.md index 972ef942..0b7cc4a3 100644 --- a/Update Notes/2.1.1.md +++ b/Update Notes/2.1.1.md @@ -58,3 +58,5 @@ - Fixed todo overlay with cookie - nopo - Fixed todo overlay with god pot - heyngra - Fixed Slayer Overlay to now take Aatrox's +25% Slayer XP buff into account - Taoshi +- Fixed inventory backpack keybind not working without unrelated option - Lulonaut +- Fixed wither cloak overlay staying on when picking up the item in the inventory - Lulonaut diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/WitherCloakChanger.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/WitherCloakChanger.java index 84ee76c5..02d7bf7b 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/WitherCloakChanger.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/WitherCloakChanger.java @@ -35,6 +35,13 @@ import org.lwjgl.opengl.GL14; public class WitherCloakChanger { public static boolean isCloakActive = false; + /** + * When was the last charged Creeper that is a member of the group rendered? + * Used to determine if the cloak was deactivated by Hypixel without sending a message + * + * @see io.github.moulberry.notenoughupdates.mixins.MixinEntityChargedCreeper#cancelChargedCreeperLayer(net.minecraft.entity.monster.EntityCreeper , float, float, float, float, float, float, float, org.spongepowered.asm.mixin.injection.callback.CallbackInfo) + */ + public static long lastCreeperRender = 0; public static long lastDeactivate = System.currentTimeMillis(); @SubscribeEvent(priority = EventPriority.HIGHEST) @@ -63,6 +70,16 @@ public class WitherCloakChanger { @SubscribeEvent public void onRenderLast(RenderWorldLastEvent event) { + if (isCloakActive) { + //last creeper rendered over 2 seconds ago -> Creeper Veil de activated without a message. Happens for example when picking up the item in the inventory + if (System.currentTimeMillis() - lastCreeperRender >= 2000) { + isCloakActive = false; + lastDeactivate = System.currentTimeMillis(); + lastCreeperRender = 0; + return; + } + } + if (!NotEnoughUpdates.INSTANCE.isOnSkyblock() || !isCloakActive || !NotEnoughUpdates.INSTANCE.config.itemOverlays.customWitherCloakToggle) return; Minecraft mc = Minecraft.getMinecraft(); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinEntityChargedCreeper.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinEntityChargedCreeper.java index a9b88d6b..d6900261 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinEntityChargedCreeper.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinEntityChargedCreeper.java @@ -41,6 +41,7 @@ public abstract class MixinEntityChargedCreeper { (WitherCloakChanger.isCloakActive || System.currentTimeMillis() - WitherCloakChanger.lastDeactivate < 300) && NotEnoughUpdates.INSTANCE.isOnSkyblock(); if (isWitherCloak) { + WitherCloakChanger.lastCreeperRender = System.currentTimeMillis(); if (ci.isCancellable()) { ci.cancel(); } |