diff options
author | bowser0000 <bowser0000@gmail.com> | 2021-04-08 08:43:19 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-08 08:43:19 -0400 |
commit | 14efcd8b81763d1c06a4291eeb6a0f1aaeb770fe (patch) | |
tree | 5b58218f51e6f358e5dd15946580dd7b7159c79a /src/main/java/me/Danker/features/LowHealthNotifications.java | |
parent | 435d8dfd5a7f36803ceefcbd245e814ec735aced (diff) | |
parent | 8b1c19bff9ca13034e794ef76086e75aaf59bd14 (diff) | |
download | SkyblockMod-14efcd8b81763d1c06a4291eeb6a0f1aaeb770fe.tar.gz SkyblockMod-14efcd8b81763d1c06a4291eeb6a0f1aaeb770fe.tar.bz2 SkyblockMod-14efcd8b81763d1c06a4291eeb6a0f1aaeb770fe.zip |
Merge pull request #91 from bowser0000/developmentv1.8.6
1.8.6
Diffstat (limited to 'src/main/java/me/Danker/features/LowHealthNotifications.java')
-rw-r--r-- | src/main/java/me/Danker/features/LowHealthNotifications.java | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/main/java/me/Danker/features/LowHealthNotifications.java b/src/main/java/me/Danker/features/LowHealthNotifications.java new file mode 100644 index 0000000..0bf2898 --- /dev/null +++ b/src/main/java/me/Danker/features/LowHealthNotifications.java @@ -0,0 +1,36 @@ +package me.Danker.features; + +import me.Danker.DankersSkyblockMod; +import me.Danker.commands.ToggleCommand; +import me.Danker.handlers.ScoreboardHandler; +import me.Danker.utils.Utils; +import net.minecraft.client.Minecraft; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.world.World; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; + +import java.util.List; + +public class LowHealthNotifications { + + @SubscribeEvent + public void onTick(TickEvent.ClientTickEvent event) { + if (event.phase != TickEvent.Phase.START) return; + + World world = Minecraft.getMinecraft().theWorld; + if (DankersSkyblockMod.tickAmount % 2 == 0) { + if (ToggleCommand.lowHealthNotifyToggled && Utils.inDungeons && world != null) { + List<String> scoreboard = ScoreboardHandler.getSidebarLines(); + for (String score : scoreboard) { + if (score.endsWith("❤") && score.matches(".* §c\\d.*")) { + String name = score.substring(score.indexOf(" ") + 1); + Utils.createTitle(EnumChatFormatting.RED + "LOW HEALTH!\n" + name, 1); + break; + } + } + } + } + } + +} |