aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLulonaut <lulonaut@tutanota.de>2022-12-07 03:49:13 +0100
committerGitHub <noreply@github.com>2022-12-07 13:49:13 +1100
commit200549b4255c50dfaf55fc46e0e08bdfd672435a (patch)
tree4a565ddd8fbd1b5889393eeaad9859c9b3e8ce3a /src
parentdccf7ee3c7797b92360a91f5bc34d99ef997d0bd (diff)
downloadNotEnoughUpdates-200549b4255c50dfaf55fc46e0e08bdfd672435a.tar.gz
NotEnoughUpdates-200549b4255c50dfaf55fc46e0e08bdfd672435a.tar.bz2
NotEnoughUpdates-200549b4255c50dfaf55fc46e0e08bdfd672435a.zip
Disable wither cloak overlay when creepers are gone (#473)
Diffstat (limited to 'src')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/WitherCloakChanger.java17
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinEntityChargedCreeper.java1
2 files changed, 18 insertions, 0 deletions
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();
}