diff options
author | bowser0000 <bowser0000@gmail.com> | 2022-04-30 21:39:28 -0400 |
---|---|---|
committer | bowser0000 <bowser0000@gmail.com> | 2022-04-30 21:39:28 -0400 |
commit | 5f2acec6bce0cfdd0c435982a01f7f6d7b79e8b9 (patch) | |
tree | c98cf9a90b960798cb21f2a90fed6f3fdc463476 /src | |
parent | 7f71df3d99a2c9b318c0b9de7c4e1577af5c9294 (diff) | |
download | SkyblockMod-5f2acec6bce0cfdd0c435982a01f7f6d7b79e8b9.tar.gz SkyblockMod-5f2acec6bce0cfdd0c435982a01f7f6d7b79e8b9.tar.bz2 SkyblockMod-5f2acec6bce0cfdd0c435982a01f7f6d7b79e8b9.zip |
Add thunder/jawbus spawn alerts
Diffstat (limited to 'src')
5 files changed, 71 insertions, 1 deletions
diff --git a/src/main/java/me/Danker/DankersSkyblockMod.java b/src/main/java/me/Danker/DankersSkyblockMod.java index 3eaac50..6e82137 100644 --- a/src/main/java/me/Danker/DankersSkyblockMod.java +++ b/src/main/java/me/Danker/DankersSkyblockMod.java @@ -64,7 +64,7 @@ import java.util.Map; @Mod(modid = DankersSkyblockMod.MODID, version = DankersSkyblockMod.VERSION, clientSideOnly = true) public class DankersSkyblockMod { public static final String MODID = "Danker's Skyblock Mod"; - public static final String VERSION = "1.8.7-beta6"; + public static final String VERSION = "1.8.7-beta7"; public static int titleTimer = -1; public static boolean showTitle = false; public static String titleText = ""; @@ -128,6 +128,7 @@ public class DankersSkyblockMod { MinecraftForge.EVENT_BUS.register(new ExpertiseLore()); MinecraftForge.EVENT_BUS.register(new FasterMaddoxCalling()); MinecraftForge.EVENT_BUS.register(new FirePillarDisplay()); + MinecraftForge.EVENT_BUS.register(new FishingSpawnAlerts()); MinecraftForge.EVENT_BUS.register(new GemstonesLore()); MinecraftForge.EVENT_BUS.register(new GiantHPDisplay()); MinecraftForge.EVENT_BUS.register(new GoldenEnchants()); diff --git a/src/main/java/me/Danker/commands/ToggleCommand.java b/src/main/java/me/Danker/commands/ToggleCommand.java index 6472d23..09b59d9 100644 --- a/src/main/java/me/Danker/commands/ToggleCommand.java +++ b/src/main/java/me/Danker/commands/ToggleCommand.java @@ -62,6 +62,7 @@ public class ToggleCommand extends CommandBase implements ICommand { public static boolean autoJoinSkyblock; public static boolean firePillar; public static boolean aliases; + public static boolean fishingAlert; // Chat Messages public static boolean sceptreMessages; public static boolean midasStaffMessages; diff --git a/src/main/java/me/Danker/features/FishingSpawnAlerts.java b/src/main/java/me/Danker/features/FishingSpawnAlerts.java new file mode 100644 index 0000000..3f11dfc --- /dev/null +++ b/src/main/java/me/Danker/features/FishingSpawnAlerts.java @@ -0,0 +1,60 @@ +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.Entity; +import net.minecraft.entity.item.EntityArmorStand; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StringUtils; +import net.minecraft.world.World; +import net.minecraftforge.event.world.WorldEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; + +import java.util.List; + +public class FishingSpawnAlerts { + + static boolean lastThunder = false; + static boolean lastJawbus = false; + + @SubscribeEvent + public void onTick(TickEvent.ClientTickEvent event) { + if (event.phase != TickEvent.Phase.START) return; + + World world = Minecraft.getMinecraft().theWorld; + if (DankersSkyblockMod.tickAmount % 10 == 0) { + if (ToggleCommand.fishingAlert && Utils.tabLocation.equals("Crimson Isle") && world != null) { + boolean thunder = false; + boolean jawbus = false; + List<Entity> entities = world.getLoadedEntityList(); + + for (Entity entity : entities) { + if (entity instanceof EntityArmorStand) { + String name = StringUtils.stripControlCodes(entity.getName()); + if (name.contains("Thunder")) { + thunder = true; + } else if (name.contains("Lord Jawbus")) { + jawbus = true; + } + } + } + + if (thunder && !lastThunder) Utils.createTitle(EnumChatFormatting.AQUA + "THUNDER", 2); + if (jawbus && !lastJawbus) Utils.createTitle(EnumChatFormatting.AQUA + "JAWBUS", 2); + + lastThunder = thunder; + lastJawbus = jawbus; + } + } + } + + @SubscribeEvent + public void onWorldChange(WorldEvent.Load event) { + lastThunder = false; + lastJawbus = false; + } + +} diff --git a/src/main/java/me/Danker/gui/DankerGui.java b/src/main/java/me/Danker/gui/DankerGui.java index abf9ffa..9e013b7 100644 --- a/src/main/java/me/Danker/gui/DankerGui.java +++ b/src/main/java/me/Danker/gui/DankerGui.java @@ -90,6 +90,7 @@ public class DankerGui extends GuiScreen { private GuiButton hideArmour; private GuiButton autoJoinSkyblock; private GuiButton firePillar; + private GuiButton fishingAlert; // Chat Messages private GuiButton sceptreMessages; private GuiButton midasStaffMessages; @@ -184,6 +185,7 @@ public class DankerGui extends GuiScreen { hideArmour = new FeatureButton("Hide Player Armour: " + Utils.getColouredBoolean(ToggleCommand.hideArmour), "Makes player armour invisible, showing their skin."); autoJoinSkyblock = new FeatureButton("Automatically Join Skyblock: " + Utils.getColouredBoolean(ToggleCommand.autoJoinSkyblock), "Automatically join Skyblock when you join Hypixel.\nYou have an addiction."); firePillar = new FeatureButton("Fire Pillar Display: " + Utils.getColouredBoolean(ToggleCommand.firePillar), "Displays blaze fire pillar text on screen"); + fishingAlert = new FeatureButton("Fishing Spawn Alerts: " + Utils.getColouredBoolean(ToggleCommand.fishingAlert), "Alerts when a Thunder or Lord Jawbus spawns nearby"); allButtons.clear(); allButtons.add(changeDisplay); @@ -244,6 +246,7 @@ public class DankerGui extends GuiScreen { allButtons.add(hideArmour); allButtons.add(autoJoinSkyblock); allButtons.add(firePillar); + allButtons.add(fishingAlert); search.setText(initSearchText); search.setVisible(true); @@ -537,6 +540,10 @@ public class DankerGui extends GuiScreen { ToggleCommand.firePillar = !ToggleCommand.firePillar; ConfigHandler.writeBooleanConfig("toggles", "FirePillar", ToggleCommand.firePillar); firePillar.displayString = "Fire Pillar Display: " + Utils.getColouredBoolean(ToggleCommand.firePillar); + } else if (button == fishingAlert) { + ToggleCommand.fishingAlert = !ToggleCommand.fishingAlert; + ConfigHandler.writeBooleanConfig("toggles", "FishingAlert", ToggleCommand.fishingAlert); + fishingAlert.displayString = "Fishing Spawn Alerts: " + Utils.getColouredBoolean(ToggleCommand.fishingAlert); } } diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java index 4415a8e..48693c8 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -247,6 +247,7 @@ public class ConfigHandler { ToggleCommand.autoJoinSkyblock = initBoolean("toggles", "AutoJoinSkyblock", false); ToggleCommand.firePillar = initBoolean("toggles", "FirePillar", false); ToggleCommand.aliases = initBoolean("toggles", "Aliases", false); + ToggleCommand.fishingAlert = initBoolean("toggles", "FishingAlert", false); // Chat Messages ToggleCommand.sceptreMessages = initBoolean("toggles", "SceptreMessages", true); ToggleCommand.midasStaffMessages = initBoolean("toggles", "MidasStaffMessages", true); |