aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/Danker/features/GolemSpawningAlert.java
diff options
context:
space:
mode:
authorbowser0000 <bowser0000@gmail.com>2021-03-28 19:22:35 -0400
committerbowser0000 <bowser0000@gmail.com>2021-03-28 19:22:35 -0400
commit032cbaea86a08b98a239257f464a00a925068fda (patch)
tree4cc9048140cd9117194ac5b164aa8388f3a349a9 /src/main/java/me/Danker/features/GolemSpawningAlert.java
parent57e5469f651610a4f07bf8e5266b789d7ca1fe34 (diff)
downloadSkyblockMod-032cbaea86a08b98a239257f464a00a925068fda.tar.gz
SkyblockMod-032cbaea86a08b98a239257f464a00a925068fda.tar.bz2
SkyblockMod-032cbaea86a08b98a239257f464a00a925068fda.zip
Add 20s countdown to golem alert
Diffstat (limited to 'src/main/java/me/Danker/features/GolemSpawningAlert.java')
-rw-r--r--src/main/java/me/Danker/features/GolemSpawningAlert.java32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/main/java/me/Danker/features/GolemSpawningAlert.java b/src/main/java/me/Danker/features/GolemSpawningAlert.java
index 91b647e..de5cb89 100644
--- a/src/main/java/me/Danker/features/GolemSpawningAlert.java
+++ b/src/main/java/me/Danker/features/GolemSpawningAlert.java
@@ -1,14 +1,26 @@
package me.Danker.features;
+import me.Danker.commands.MoveCommand;
+import me.Danker.commands.ScaleCommand;
import me.Danker.commands.ToggleCommand;
+import me.Danker.events.RenderOverlay;
+import me.Danker.handlers.TextRenderer;
import me.Danker.utils.Utils;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.Gui;
import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StringUtils;
import net.minecraftforge.client.event.ClientChatReceivedEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
+import org.lwjgl.opengl.GL11;
public class GolemSpawningAlert {
+ double golemTime = 0;
+ public static final ResourceLocation GOLEM_ICON = new ResourceLocation("dsm", "icons/golem.png");
+ public static String GOLEM_COLOUR;
+
@SubscribeEvent
public void onChat(ClientChatReceivedEvent event) {
String message = StringUtils.stripControlCodes(event.message.getUnformattedText());
@@ -18,9 +30,29 @@ public class GolemSpawningAlert {
if (ToggleCommand.golemAlertToggled) {
if (message.contains("The ground begins to shake as an Endstone Protector rises from below!")) {
+ golemTime = System.currentTimeMillis() / 1000 + 20;
Utils.createTitle(EnumChatFormatting.RED + "GOLEM SPAWNING!", 3);
}
}
}
+ @SubscribeEvent
+ public void renderPlayerInfo(RenderOverlay event) {
+ if (ToggleCommand.golemAlertToggled && Utils.inSkyblock && golemTime > System.currentTimeMillis() / 1000) {
+ Minecraft mc = Minecraft.getMinecraft();
+ double scale = ScaleCommand.golemTimerScale;
+ double scaleReset = Math.pow(scale, -1);
+ GL11.glScaled(scale, scale, scale);
+
+ double timeNow = System.currentTimeMillis() / 1000;
+ mc.getTextureManager().bindTexture(GOLEM_ICON);
+ Gui.drawModalRectWithCustomSizedTexture(MoveCommand.golemTimerXY[0], MoveCommand.golemTimerXY[1], 0, 0, 16, 16, 16, 16);
+
+ String golemText = GOLEM_COLOUR + Utils.getTimeBetween(timeNow, golemTime);
+ new TextRenderer(mc, golemText, MoveCommand.golemTimerXY[0] + 20, MoveCommand.golemTimerXY[1] + 5, 1);
+
+ GL11.glScaled(scaleReset, scaleReset, scaleReset);
+ }
+ }
+
}