diff options
author | bowser0000 <bowser0000@gmail.com> | 2021-07-05 12:52:46 -0400 |
---|---|---|
committer | bowser0000 <bowser0000@gmail.com> | 2021-07-05 12:52:46 -0400 |
commit | a44dc53ce80e9914595d5b646dc5623ddd3450b1 (patch) | |
tree | aa171433d7cc60b879c72a7c563e0bfb25a29257 /src/main/java/me/Danker/features | |
parent | 17d42cffb8264a604e93052ee146887ae7fd32cb (diff) | |
download | SkyblockMod-a44dc53ce80e9914595d5b646dc5623ddd3450b1.tar.gz SkyblockMod-a44dc53ce80e9914595d5b646dc5623ddd3450b1.tar.bz2 SkyblockMod-a44dc53ce80e9914595d5b646dc5623ddd3450b1.zip |
Add alert when reaching end of farm
Diffstat (limited to 'src/main/java/me/Danker/features')
-rw-r--r-- | src/main/java/me/Danker/features/EndOfFarmAlert.java | 40 | ||||
-rw-r--r-- | src/main/java/me/Danker/features/Skill50Display.java | 2 |
2 files changed, 41 insertions, 1 deletions
diff --git a/src/main/java/me/Danker/features/EndOfFarmAlert.java b/src/main/java/me/Danker/features/EndOfFarmAlert.java new file mode 100644 index 0000000..ecbf3ee --- /dev/null +++ b/src/main/java/me/Danker/features/EndOfFarmAlert.java @@ -0,0 +1,40 @@ +package me.Danker.features; + +import me.Danker.DankersSkyblockMod; +import me.Danker.commands.ToggleCommand; +import me.Danker.utils.Utils; +import net.minecraft.client.Minecraft; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.EnumChatFormatting; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; + +public class EndOfFarmAlert { + + static boolean alerted = false; + public static double min = -78.5; + public static double max = 79.5; + + @SubscribeEvent + public void onTick(TickEvent.ClientTickEvent event) { + if (event.phase != TickEvent.Phase.START) return; + + EntityPlayer player = Minecraft.getMinecraft().thePlayer; + if (DankersSkyblockMod.tickAmount % 10 == 0) { + if (ToggleCommand.endOfFarmAlert && Utils.isInScoreboard("Your Island")) { + double x = player.posX; + double z = player.posZ; + + if (x <= min || x >= max || z <= min || z >= max) { + if (!alerted) { + alerted = true; + Utils.createTitle(EnumChatFormatting.RED + "END OF FARM", 1); + } + } else { + alerted = false; + } + } + } + } + +} diff --git a/src/main/java/me/Danker/features/Skill50Display.java b/src/main/java/me/Danker/features/Skill50Display.java index 99b1d62..54afb3a 100644 --- a/src/main/java/me/Danker/features/Skill50Display.java +++ b/src/main/java/me/Danker/features/Skill50Display.java @@ -114,7 +114,7 @@ public class Skill50Display { @SubscribeEvent public void renderPlayerInfo(RenderOverlay event) { - if (!Utils.skillsInitialized()) { + if (!Utils.skillsInitialized() && Utils.inSkyblock) { new TextRenderer(Minecraft.getMinecraft(), EnumChatFormatting.RED + "Please open the skill menu to use skill features.", MoveCommand.skill50XY[0], MoveCommand.skill50XY[0], ScaleCommand.skill50Scale); return; } |