aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorbowser0000 <bowser0000@gmail.com>2021-07-05 12:52:46 -0400
committerbowser0000 <bowser0000@gmail.com>2021-07-05 12:52:46 -0400
commita44dc53ce80e9914595d5b646dc5623ddd3450b1 (patch)
treeaa171433d7cc60b879c72a7c563e0bfb25a29257 /src/main/java
parent17d42cffb8264a604e93052ee146887ae7fd32cb (diff)
downloadSkyblockMod-a44dc53ce80e9914595d5b646dc5623ddd3450b1.tar.gz
SkyblockMod-a44dc53ce80e9914595d5b646dc5623ddd3450b1.tar.bz2
SkyblockMod-a44dc53ce80e9914595d5b646dc5623ddd3450b1.zip
Add alert when reaching end of farm
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/me/Danker/DankersSkyblockMod.java4
-rw-r--r--src/main/java/me/Danker/commands/DHelpCommand.java1
-rw-r--r--src/main/java/me/Danker/commands/DankerGuiCommand.java3
-rw-r--r--src/main/java/me/Danker/commands/FarmLengthCommand.java50
-rw-r--r--src/main/java/me/Danker/commands/ToggleCommand.java13
-rw-r--r--src/main/java/me/Danker/features/EndOfFarmAlert.java40
-rw-r--r--src/main/java/me/Danker/features/Skill50Display.java2
-rw-r--r--src/main/java/me/Danker/gui/DankerGui.java7
-rw-r--r--src/main/java/me/Danker/handlers/ConfigHandler.java4
9 files changed, 119 insertions, 5 deletions
diff --git a/src/main/java/me/Danker/DankersSkyblockMod.java b/src/main/java/me/Danker/DankersSkyblockMod.java
index 937b411..1b736ca 100644
--- a/src/main/java/me/Danker/DankersSkyblockMod.java
+++ b/src/main/java/me/Danker/DankersSkyblockMod.java
@@ -67,7 +67,7 @@ import java.util.stream.Collectors;
@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-beta2";
+ public static final String VERSION = "1.8.7-beta3";
public static int titleTimer = -1;
public static boolean showTitle = false;
public static String titleText = "";
@@ -115,6 +115,7 @@ public class DankersSkyblockMod {
MinecraftForge.EVENT_BUS.register(new CreeperSolver());
MinecraftForge.EVENT_BUS.register(new CustomMusic());
MinecraftForge.EVENT_BUS.register(new DungeonTimer());
+ MinecraftForge.EVENT_BUS.register(new EndOfFarmAlert());
MinecraftForge.EVENT_BUS.register(new ExpertiseLore());
MinecraftForge.EVENT_BUS.register(new FasterMaddoxCalling());
MinecraftForge.EVENT_BUS.register(new GiantHPDisplay());
@@ -185,6 +186,7 @@ public class DankersSkyblockMod {
ClientCommandHandler.instance.registerCommand(new DisplayCommand());
ClientCommandHandler.instance.registerCommand(new DungeonsCommand());
ClientCommandHandler.instance.registerCommand(new FairySoulsCommand());
+ ClientCommandHandler.instance.registerCommand(new FarmLengthCommand());
ClientCommandHandler.instance.registerCommand(new GetkeyCommand());
ClientCommandHandler.instance.registerCommand(new GuildOfCommand());
ClientCommandHandler.instance.registerCommand(new ImportFishingCommand());
diff --git a/src/main/java/me/Danker/commands/DHelpCommand.java b/src/main/java/me/Danker/commands/DHelpCommand.java
index 42a82c4..b88f6cc 100644
--- a/src/main/java/me/Danker/commands/DHelpCommand.java
+++ b/src/main/java/me/Danker/commands/DHelpCommand.java
@@ -59,6 +59,7 @@ public class DHelpCommand extends CommandBase {
EnumChatFormatting.GOLD + PlayerCommand.usage(arg0) + EnumChatFormatting.AQUA + " - Uses API to find skills, slayers, coins and weight of a player.\n" +
EnumChatFormatting.GOLD + ReloadConfigCommand.usage(arg0) + EnumChatFormatting.AQUA + " - Reloads Danker's Skyblock Mod config.\n" +
EnumChatFormatting.GOLD + ReloadRepoCommand.usage(arg0) + EnumChatFormatting.AQUA + " - Reloads Danker's Skyblock Mod repository.\n" +
+ EnumChatFormatting.GOLD + FarmLengthCommand.usage(arg0) + EnumChatFormatting.AQUA + " - Sets coords to be used for end of farm alert.\n" +
EnumChatFormatting.GREEN + " Open Maddox Menu" + EnumChatFormatting.AQUA + " - M by default.\n" +
EnumChatFormatting.GREEN + " Start/Stop Skill Tracker" + EnumChatFormatting.AQUA + " - Numpad 5 by default.\n"));
}
diff --git a/src/main/java/me/Danker/commands/DankerGuiCommand.java b/src/main/java/me/Danker/commands/DankerGuiCommand.java
index edec93f..4375d57 100644
--- a/src/main/java/me/Danker/commands/DankerGuiCommand.java
+++ b/src/main/java/me/Danker/commands/DankerGuiCommand.java
@@ -1,6 +1,7 @@
package me.Danker.commands;
import me.Danker.DankersSkyblockMod;
+import me.Danker.features.EndOfFarmAlert;
import me.Danker.features.SkillTracker;
import me.Danker.features.loot.LootDisplay;
import net.minecraft.client.Minecraft;
@@ -97,6 +98,7 @@ public class DankerGuiCommand extends CommandBase {
debug.append("[gianthp][").append(ToggleCommand.giantHP).append("]\n");
debug.append("[hidepetcandy][").append(ToggleCommand.hidePetCandy).append("]\n");
debug.append("[customcolourednames][").append(ToggleCommand.customColouredNames).append("]\n");
+ debug.append("[endoffarmalert][").append(ToggleCommand.endOfFarmAlert).append("]\n");
debug.append("[dungeonbossmusic][").append(ToggleCommand.dungeonBossMusic).append("]\n");
debug.append("[bloodroommusic][").append(ToggleCommand.bloodRoomMusic).append("]\n");
debug.append("[dungeonmusic][").append(ToggleCommand.dungeonMusic).append("]\n");
@@ -113,6 +115,7 @@ public class DankerGuiCommand extends CommandBase {
debug.append("[Current Display][").append(LootDisplay.display).append("]\n");
debug.append("[Auto Display][").append(LootDisplay.auto).append("]\n");
debug.append("[Skill Tracker Visible][").append(SkillTracker.showSkillTracker).append("]\n");
+ debug.append("[Farm Length][").append(EndOfFarmAlert.min).append(" to ").append(EndOfFarmAlert.max).append("]\n");
debug.append("# Problematic Mods\n");
debug.append("[LabyMod][").append(DankersSkyblockMod.usingLabymod).append("]\n");
debug.append("[OAM][").append(DankersSkyblockMod.usingOAM).append("]\n");
diff --git a/src/main/java/me/Danker/commands/FarmLengthCommand.java b/src/main/java/me/Danker/commands/FarmLengthCommand.java
new file mode 100644
index 0000000..6a28430
--- /dev/null
+++ b/src/main/java/me/Danker/commands/FarmLengthCommand.java
@@ -0,0 +1,50 @@
+package me.Danker.commands;
+
+import me.Danker.DankersSkyblockMod;
+import me.Danker.features.EndOfFarmAlert;
+import me.Danker.handlers.ConfigHandler;
+import net.minecraft.command.CommandBase;
+import net.minecraft.command.CommandException;
+import net.minecraft.command.ICommandSender;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.util.ChatComponentText;
+
+public class FarmLengthCommand extends CommandBase {
+
+ @Override
+ public String getCommandName() {
+ return "dsmfarmlength";
+ }
+
+ @Override
+ public String getCommandUsage(ICommandSender arg0) {
+ return "/" + getCommandName() + " <min coords> <max coords>";
+ }
+
+ public static String usage(ICommandSender arg0) {
+ return new FarmLengthCommand().getCommandUsage(arg0);
+ }
+
+ @Override
+ public int getRequiredPermissionLevel() {
+ return 0;
+ }
+
+ @Override
+ public void processCommand(ICommandSender arg0, String[] arg1) throws CommandException {
+ EntityPlayer player = (EntityPlayer) arg0;
+
+ if (arg1.length == 0) {
+ player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Current Range: " + DankersSkyblockMod.SECONDARY_COLOUR + EndOfFarmAlert.min + DankersSkyblockMod.MAIN_COLOUR + " to " + DankersSkyblockMod.SECONDARY_COLOUR + EndOfFarmAlert.max));
+ } else if (arg1.length < 2) {
+ player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0)));
+ return;
+ }
+
+ EndOfFarmAlert.min = Double.parseDouble(arg1[0]);
+ EndOfFarmAlert.max = Double.parseDouble(arg1[1]);
+ ConfigHandler.writeDoubleConfig("misc", "farmMin", EndOfFarmAlert.min);
+ ConfigHandler.writeDoubleConfig("misc", "farmMax", EndOfFarmAlert.max);
+ }
+
+}
diff --git a/src/main/java/me/Danker/commands/ToggleCommand.java b/src/main/java/me/Danker/commands/ToggleCommand.java
index 11b15f3..44b1df2 100644
--- a/src/main/java/me/Danker/commands/ToggleCommand.java
+++ b/src/main/java/me/Danker/commands/ToggleCommand.java
@@ -1,7 +1,9 @@
package me.Danker.commands;
+import jdk.nashorn.internal.runtime.regexp.joni.Config;
import me.Danker.DankersSkyblockMod;
import me.Danker.features.CustomMusic;
+import me.Danker.features.EndOfFarmAlert;
import me.Danker.handlers.ConfigHandler;
import net.minecraft.command.CommandBase;
import net.minecraft.command.CommandException;
@@ -38,6 +40,7 @@ public class ToggleCommand extends CommandBase implements ICommand {
public static boolean giantHP;
public static boolean hidePetCandy;
public static boolean customColouredNames;
+ public static boolean endOfFarmAlert;
// Chat Messages
public static boolean sceptreMessages;
public static boolean midasStaffMessages;
@@ -99,7 +102,7 @@ public class ToggleCommand extends CommandBase implements ICommand {
"startswithterminal/selectallterminal/clickinorderterminal/" +
"ultrasequencer/chronomatron/superpairs/hidetooltipsinaddons/pickblock/" +
"melodytooltips/highlightslayers/highlightarachne/highlightskeletonmasters/teammatesinradius/" +
- "gianthp/hidepetcandy/customcolorednames/dungeonbossmusic/bloodroommusic/dungeonmusic/list>";
+ "gianthp/hidepetcandy/customcolorednames/endoffarmalert/dungeonbossmusic/bloodroommusic/dungeonmusic/list>";
}
public static String usage(ICommandSender arg0) {
@@ -128,7 +131,7 @@ public class ToggleCommand extends CommandBase implements ICommand {
"ultrasequencer", "chronomatron", "superpairs",
"hidetooltipsinaddons", "pickblock", "melodytooltips", "highlightslayers",
"highlightskeletonmasters", "dungeonbossmusic", "bloodroommusic", "dungeonmusic",
- "teammatesinradius", "gianthp", "hidepetcandy", "customcolorednames", "list");
+ "teammatesinradius", "gianthp", "hidepetcandy", "customcolorednames", "endoffarmalert", "list");
}
return null;
}
@@ -435,6 +438,11 @@ public class ToggleCommand extends CommandBase implements ICommand {
ConfigHandler.writeBooleanConfig("toggles", "CustomColouredNames", customColouredNames);
player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Custom name colors has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + customColouredNames + DankersSkyblockMod.MAIN_COLOUR + "."));
break;
+ case "endoffarmalert":
+ endOfFarmAlert = !endOfFarmAlert;
+ ConfigHandler.writeBooleanConfig("toggles", "EndOfFarmAlert", endOfFarmAlert);
+ player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "End of farm alert has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + endOfFarmAlert + DankersSkyblockMod.MAIN_COLOUR + "."));
+ break;
case "dungeonbossmusic":
dungeonBossMusic = !dungeonBossMusic;
CustomMusic.dungeonboss.stop();
@@ -504,6 +512,7 @@ public class ToggleCommand extends CommandBase implements ICommand {
DankersSkyblockMod.TYPE_COLOUR + " Giant HP display: " + DankersSkyblockMod.VALUE_COLOUR + giantHP + "\n" +
DankersSkyblockMod.TYPE_COLOUR + " Hide pet candy: " + DankersSkyblockMod.VALUE_COLOUR + hidePetCandy + "\n" +
DankersSkyblockMod.TYPE_COLOUR + " Custom name colors: " + DankersSkyblockMod.VALUE_COLOUR + customColouredNames + "\n" +
+ DankersSkyblockMod.TYPE_COLOUR + " End of farm alert: " + DankersSkyblockMod.VALUE_COLOUR + endOfFarmAlert + "\n" +
DankersSkyblockMod.TYPE_COLOUR + " Custom dungeon boss music: " + DankersSkyblockMod.VALUE_COLOUR + dungeonBossMusic + "\n" +
DankersSkyblockMod.TYPE_COLOUR + " Custom blood room music: " + DankersSkyblockMod.VALUE_COLOUR + bloodRoomMusic + "\n" +
DankersSkyblockMod.TYPE_COLOUR + " Custom dungeon music: " + DankersSkyblockMod.VALUE_COLOUR + dungeonMusic
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;
}
diff --git a/src/main/java/me/Danker/gui/DankerGui.java b/src/main/java/me/Danker/gui/DankerGui.java
index ce795f3..3f4ebe7 100644
--- a/src/main/java/me/Danker/gui/DankerGui.java
+++ b/src/main/java/me/Danker/gui/DankerGui.java
@@ -67,6 +67,7 @@ public class DankerGui extends GuiScreen {
private GuiButton giantHP;
private GuiButton hidePetCandy;
private GuiButton customColouredNames;
+ private GuiButton endOfFarmAlert;
// Chat Messages
private GuiButton sceptreMessages;
private GuiButton midasStaffMessages;
@@ -155,6 +156,7 @@ public class DankerGui extends GuiScreen {
giantHP = new FeatureButton("Display Giant HP: " + Utils.getColouredBoolean(ToggleCommand.giantHP), "Displays health of Sadan's giants during F6 bossfight and F7 blood room.");
hidePetCandy = new FeatureButton("Hide Pet Candy: " + Utils.getColouredBoolean(ToggleCommand.hidePetCandy), "Hide pet candy in pet tooltips.");
customColouredNames = new FeatureButton("Custom Name Colors: " + Utils.getColouredBoolean(ToggleCommand.customColouredNames), "Replaces some player's usernames with a custom color.");
+ endOfFarmAlert = new FeatureButton("Alert When Reaching End of Farm: " + Utils.getColouredBoolean(ToggleCommand.endOfFarmAlert), "Alerts when you go past coords set with /dsmfarmlength.");
allButtons.clear();
allButtons.add(changeDisplay);
@@ -201,6 +203,7 @@ public class DankerGui extends GuiScreen {
allButtons.add(giantHP);
allButtons.add(hidePetCandy);
allButtons.add(customColouredNames);
+ allButtons.add(endOfFarmAlert);
search.setText(initSearchText);
search.setVisible(true);
@@ -447,6 +450,10 @@ public class DankerGui extends GuiScreen {
ToggleCommand.customColouredNames = !ToggleCommand.customColouredNames;
ConfigHandler.writeBooleanConfig("toggles", "CustomColouredNames", ToggleCommand.customColouredNames);
customColouredNames.displayString = "Custom Name Colors: " + Utils.getColouredBoolean(ToggleCommand.customColouredNames);
+ } else if (button == endOfFarmAlert) {
+ ToggleCommand.endOfFarmAlert = !ToggleCommand.endOfFarmAlert;
+ ConfigHandler.writeBooleanConfig("toggles", "EndOfFarmAlert", ToggleCommand.endOfFarmAlert);
+ endOfFarmAlert.displayString = "Alert When Reaching End of Farm: " + Utils.getColouredBoolean(ToggleCommand.endOfFarmAlert);
}
}
diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java
index 002d9f7..29fa882 100644
--- a/src/main/java/me/Danker/handlers/ConfigHandler.java
+++ b/src/main/java/me/Danker/handlers/ConfigHandler.java
@@ -215,6 +215,7 @@ public class ConfigHandler {
ToggleCommand.giantHP = initBoolean("toggles", "GiantHP", false);
ToggleCommand.hidePetCandy = initBoolean("toggles", "HidePetCandy", false);
ToggleCommand.customColouredNames = initBoolean("toggles", "CustomColouredNames", true);
+ ToggleCommand.endOfFarmAlert = initBoolean("toggles", "EndOfFarmAlert", false);
// Chat Messages
ToggleCommand.sceptreMessages = initBoolean("toggles", "SceptreMessages", true);
ToggleCommand.midasStaffMessages = initBoolean("toggles", "MidasStaffMessages", true);
@@ -457,7 +458,6 @@ public class ConfigHandler {
LootTracker.ghostlyBoots = initInt("ghosts", "ghostlyBoots", 0);
LootTracker.bagOfCashs = initInt("ghosts", "bagOfCash", 0);
-
// Misc
LootDisplay.display = initString("misc", "display", "off");
LootDisplay.auto = initBoolean("misc", "autoDisplay", false);
@@ -465,6 +465,8 @@ public class ConfigHandler {
CakeTimer.cakeTime = initDouble("misc", "cakeTime", 0);
SkillTracker.showSkillTracker = initBoolean("misc", "showSkillTracker", false);
DankersSkyblockMod.firstLaunch = initBoolean("misc", "firstLaunch", true);
+ EndOfFarmAlert.min = initDouble("misc", "farmMin", -78.5);
+ EndOfFarmAlert.max = initDouble("misc", "farmMax", 79.5);
// Locations
ScaledResolution scaled = new ScaledResolution(Minecraft.getMinecraft());