aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorbowser0000 <bowser0000@gmail.com>2020-10-05 18:19:52 -0400
committerbowser0000 <bowser0000@gmail.com>2020-10-05 18:19:52 -0400
commit0379a3c43be18b22d77056eb5b26b4f239d9988e (patch)
tree6dbb1efbace7a4ab5ab85f7aee98b09c70cc4a84 /src/main
parent2a1c6ec74089d247e63e80682b48e1777b9dd388 (diff)
downloadSkyblockMod-0379a3c43be18b22d77056eb5b26b4f239d9988e.tar.gz
SkyblockMod-0379a3c43be18b22d77056eb5b26b4f239d9988e.tar.bz2
SkyblockMod-0379a3c43be18b22d77056eb5b26b4f239d9988e.zip
Add auto slayer tracker display
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/me/Danker/TheMod.java30
-rw-r--r--src/main/java/me/Danker/commands/DHelpCommand.java2
-rw-r--r--src/main/java/me/Danker/commands/DisplayCommand.java12
-rw-r--r--src/main/java/me/Danker/handlers/ConfigHandler.java2
4 files changed, 38 insertions, 8 deletions
diff --git a/src/main/java/me/Danker/TheMod.java b/src/main/java/me/Danker/TheMod.java
index ababc34..973a0da 100644
--- a/src/main/java/me/Danker/TheMod.java
+++ b/src/main/java/me/Danker/TheMod.java
@@ -56,6 +56,7 @@ import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.scoreboard.ScoreObjective;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IChatComponent;
@@ -1804,14 +1805,33 @@ public class TheMod
// Check if player is in Skyblock every second
tickAmount++;
if (tickAmount % 20 == 0) {
- EntityPlayerSP player = Minecraft.getMinecraft().thePlayer;
+ Minecraft mc = Minecraft.getMinecraft();
+ EntityPlayerSP player = mc.thePlayer;
+
if (player != null) {
Utils.checkForSkyblock();
- // if (Utils.inSkyblock) {
- // System.out.println("Autosyncing inventory to server...");
- // player.inventoryContainer.detectAndSendChanges(); // Spirit boot fix every 1 second
- // }
}
+
+ if (DisplayCommand.auto && mc != null && mc.theWorld != null) {
+ List<String> scoreboard = ScoreboardHandler.getSidebarLines();
+ boolean found = false;
+ for (String s : scoreboard) {
+ String sCleaned = ScoreboardHandler.cleanSB(s);
+ if (sCleaned.contains("Sven Packmaster")) {
+ DisplayCommand.display = "wolf";
+ found = true;
+ } else if (sCleaned.contains("Tarantula Broodfather")) {
+ DisplayCommand.display = "spider";
+ found = true;
+ } else if (sCleaned.contains("Revenant Horror")) {
+ DisplayCommand.display = "zombie";
+ found = true;
+ }
+ }
+ if (!found) DisplayCommand.display = "off";
+ ConfigHandler.writeStringConfig("misc", "display", DisplayCommand.display);
+ }
+
tickAmount = 0;
}
diff --git a/src/main/java/me/Danker/commands/DHelpCommand.java b/src/main/java/me/Danker/commands/DHelpCommand.java
index d9e6d21..65cff49 100644
--- a/src/main/java/me/Danker/commands/DHelpCommand.java
+++ b/src/main/java/me/Danker/commands/DHelpCommand.java
@@ -37,7 +37,7 @@ public class DHelpCommand extends CommandBase {
EnumChatFormatting.GOLD + " /setkey <key>" + EnumChatFormatting.AQUA + " - Sets API key.\n" +
EnumChatFormatting.GOLD + " /getkey" + EnumChatFormatting.AQUA + " - Returns key set with /setkey and copies it to your clipboard.\n" +
EnumChatFormatting.GOLD + " /loot <zombie/spider/wolf/fishing/catacombs> [winter/f(1-6)/session]" + EnumChatFormatting.AQUA + " - Returns loot received from slayer quests or fishing stats. /loot fishing winter returns winter sea creatures instead.\n" +
- EnumChatFormatting.GOLD + " /display <zombie/spider/wolf/fishing/catacombs/off> [winter/f(1-6)/session]" + EnumChatFormatting.AQUA + " - Text display for trackers. /display fishing winter displays winter sea creatures instead.\n" +
+ EnumChatFormatting.GOLD + " /display <zombie/spider/wolf/fishing/catacombs/auto/off> [winter/f(1-6)/session]" + EnumChatFormatting.AQUA + " - Text display for trackers. /display fishing winter displays winter sea creatures instead. /display auto automatically displays the loot for the slayer quest you have active.\n" +
EnumChatFormatting.GOLD + " /resetloot <zombie/spider/wolf/fishing/catacombs/confirm/cancel>" + EnumChatFormatting.AQUA + " - Resets loot for trackers. /resetloot confirm confirms the reset.\n" +
EnumChatFormatting.GOLD + " /move <coords/display/dungeontimer/skill50> <x> <y>" + EnumChatFormatting.AQUA + " - Moves text display to specified X and Y coordinates.\n" +
EnumChatFormatting.GOLD + " /scale <coords/display/dungeontimer/skill50> <scale (0.1 - 10)>" + EnumChatFormatting.AQUA + " - Scales text display to a specified multipler between 0.1x and 10x.\n" +
diff --git a/src/main/java/me/Danker/commands/DisplayCommand.java b/src/main/java/me/Danker/commands/DisplayCommand.java
index 271b172..b96ab2b 100644
--- a/src/main/java/me/Danker/commands/DisplayCommand.java
+++ b/src/main/java/me/Danker/commands/DisplayCommand.java
@@ -13,6 +13,7 @@ import net.minecraft.util.EnumChatFormatting;
public class DisplayCommand extends CommandBase {
public static String display;
+ public static boolean auto;
@Override
public String getCommandName() {
@@ -21,7 +22,7 @@ public class DisplayCommand extends CommandBase {
@Override
public String getCommandUsage(ICommandSender arg0) {
- return "/" + getCommandName() + " <zombie/spider/wolf/fishing/catacombs/off> [winter/festival/session/f(1-6)]";
+ return "/" + getCommandName() + " <zombie/spider/wolf/fishing/catacombs/auto/off> [winter/festival/session/f(1-6)]";
}
@Override
@@ -32,7 +33,7 @@ public class DisplayCommand extends CommandBase {
@Override
public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) {
if (args.length == 1) {
- return getListOfStringsMatchingLastWord(args, "wolf", "spider", "zombie", "fishing", "catacombs", "off");
+ return getListOfStringsMatchingLastWord(args, "wolf", "spider", "zombie", "fishing", "catacombs", "auto", "off");
} else if (args.length == 2 && args[0].equalsIgnoreCase("fishing")) {
return getListOfStringsMatchingLastWord(args, "winter", "festival", "session");
} else if (args.length == 2 && args[0].equalsIgnoreCase("catacombs")) {
@@ -140,13 +141,20 @@ public class DisplayCommand extends CommandBase {
player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /display catacombs <f1/f2/f3/f4/f5/f6>"));
return;
}
+ } else if (arg1[0].equalsIgnoreCase("auto")) {
+ auto = true;
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Display set to " + EnumChatFormatting.DARK_GREEN + "auto" + EnumChatFormatting.GREEN + "."));
+ cf.writeBooleanConfig("misc", "autoDisplay", true);
+ return;
} else if (arg1[0].equalsIgnoreCase("off")) {
display = "off";
} else {
player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: " + getCommandUsage(arg0)));
return;
}
+ auto = false;
player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Display set to " + EnumChatFormatting.DARK_GREEN + display + EnumChatFormatting.GREEN + "."));
+ cf.writeBooleanConfig("misc", "autoDisplay", false);
cf.writeStringConfig("misc", "display", display);
}
diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java
index dede01f..0c839d1 100644
--- a/src/main/java/me/Danker/handlers/ConfigHandler.java
+++ b/src/main/java/me/Danker/handlers/ConfigHandler.java
@@ -316,6 +316,7 @@ public class ConfigHandler {
if (!hasKey("catacombs", "floorSixTime")) writeDoubleConfig("catacombs", "floorSixTime", 0);
if (!hasKey("misc", "display")) writeStringConfig("misc", "display", "off");
+ if (!hasKey("misc", "autoDisplay")) writeBooleanConfig("misc", "autoDisplay", false);
ScaledResolution scaled = new ScaledResolution(Minecraft.getMinecraft());
int height = scaled.getScaledHeight();
@@ -485,6 +486,7 @@ public class ConfigHandler {
final DisplayCommand ds = new DisplayCommand();
ds.display = getString("misc", "display");
+ ds.auto = getBoolean("misc", "autoDisplay");
final MoveCommand moc = new MoveCommand();
moc.coordsXY[0] = getInt("locations", "coordsX");