aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/Danker
diff options
context:
space:
mode:
authorbowser0000 <bowser0000@gmail.com>2020-12-05 03:40:24 -0500
committerbowser0000 <bowser0000@gmail.com>2020-12-05 03:40:24 -0500
commitb294ee1f83d85bc58bc9b9f97f94135d395ebf74 (patch)
tree9ce532e9dc0aa1e14bfe465d4cabd752f60c818c /src/main/java/me/Danker
parentc1ba7f1ffab9262cbf5c13e3377e4e927329d85b (diff)
downloadSkyblockMod-b294ee1f83d85bc58bc9b9f97f94135d395ebf74.tar.gz
SkyblockMod-b294ee1f83d85bc58bc9b9f97f94135d395ebf74.tar.bz2
SkyblockMod-b294ee1f83d85bc58bc9b9f97f94135d395ebf74.zip
Add Chronomatron solver
Diffstat (limited to 'src/main/java/me/Danker')
-rw-r--r--src/main/java/me/Danker/DankersSkyblockMod.java68
-rw-r--r--src/main/java/me/Danker/commands/DHelpCommand.java2
-rw-r--r--src/main/java/me/Danker/commands/ToggleCommand.java12
-rw-r--r--src/main/java/me/Danker/gui/ExperimentsGui.java9
-rw-r--r--src/main/java/me/Danker/handlers/ConfigHandler.java2
5 files changed, 78 insertions, 15 deletions
diff --git a/src/main/java/me/Danker/DankersSkyblockMod.java b/src/main/java/me/Danker/DankersSkyblockMod.java
index 22a8009..35a19c9 100644
--- a/src/main/java/me/Danker/DankersSkyblockMod.java
+++ b/src/main/java/me/Danker/DankersSkyblockMod.java
@@ -11,6 +11,7 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiChat;
+import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.gui.inventory.GuiChest;
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.entity.Entity;
@@ -25,6 +26,7 @@ import net.minecraft.inventory.Container;
import net.minecraft.inventory.ContainerChest;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
+import net.minecraft.item.Item;
import net.minecraft.item.ItemMap;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@@ -88,7 +90,6 @@ public class DankersSkyblockMod
static String lastMaddoxCommand = "/cb placeholder";
static double lastMaddoxTime = 0;
static KeyBinding[] keyBindings = new KeyBinding[2];
- static int lastMouse = -1;
static boolean usingLabymod = false;
public static String guiToOpen = null;
static boolean foundLivid = false;
@@ -113,6 +114,9 @@ public class DankersSkyblockMod
static boolean inWaterRoom = false;
static AxisAlignedBB correctTicTacToeButton = null;
static List<Slot> clickInOrderSlots = new ArrayList<>();
+ static int lastChronomatronRound = 0;
+ static List<String> chronomatronPattern = new ArrayList<>();
+ static int chronomatronMouseClicks = 0;
static double dungeonStartTime = 0;
static double bloodOpenTime = 0;
@@ -2747,8 +2751,8 @@ public class DankersSkyblockMod
@SubscribeEvent
public void onGuiMouseInputPre(GuiScreenEvent.MouseInputEvent.Pre event) {
if (!Utils.inSkyblock) return;
- if (Mouse.getEventButton() == lastMouse) return;
if (Mouse.getEventButton() != 0 && Mouse.getEventButton() != 1) return; // Left click or right click
+ if (!Mouse.isButtonDown(0) && !Mouse.isButtonDown(1)) return;
if (event.gui instanceof GuiChest) {
Container containerChest = ((GuiChest) event.gui).inventorySlots;
@@ -2757,11 +2761,11 @@ public class DankersSkyblockMod
GuiChest chest = (GuiChest) event.gui;
IInventory inventory = ((ContainerChest) containerChest).getLowerChestInventory();
Slot mouseSlot = chest.getSlotUnderMouse();
- if (mouseSlot == null || mouseSlot.getStack() == null) return;
+ if (mouseSlot == null) return;
ItemStack item = mouseSlot.getStack();
String inventoryName = inventory.getDisplayName().getUnformattedText();
-
- if (inventoryName.endsWith(" Chest") && item.getDisplayName().contains("Open Reward Chest")) {
+
+ if (inventoryName.endsWith(" Chest") && item != null && item.getDisplayName().contains("Open Reward Chest")) {
List<String> tooltip = item.getTooltip(Minecraft.getMinecraft().thePlayer, Minecraft.getMinecraft().gameSettings.advancedItemTooltips);
for (String lineUnclean : tooltip) {
String line = StringUtils.stripControlCodes(lineUnclean);
@@ -2809,9 +2813,15 @@ public class DankersSkyblockMod
break;
}
}
- }
+ }
+
+ if (ToggleCommand.chronomatronToggled && inventoryName.startsWith("Chronomatron (")) {
+ if (inventory.getStackInSlot(49).getDisplayName().startsWith("§7Timer: §a") && (item == null || item.getItem() == Item.getItemFromBlock(Blocks.stained_glass) || item.getItem() == Item.getItemFromBlock(Blocks.stained_hardened_clay))) {
+ chronomatronMouseClicks++;
+ }
+ }
- if (!BlockSlayerCommand.onlySlayerName.equals("")) {
+ if (!BlockSlayerCommand.onlySlayerName.equals("") && item != null) {
if (inventoryName.equals("Slayer")) {
if (!item.getDisplayName().contains("Revenant Horror") && !item.getDisplayName().contains("Tarantula Broodfather") && !item.getDisplayName().contains("Sven Packmaster")) return;
if (!item.getDisplayName().contains(BlockSlayerCommand.onlySlayerName)) {
@@ -2838,19 +2848,19 @@ public class DankersSkyblockMod
@SubscribeEvent
public void onMouseInputPost(GuiScreenEvent.MouseInputEvent.Post event) {
if (!Utils.inSkyblock) return;
- if (Mouse.getEventButton() == lastMouse) return;
if (Mouse.getEventButton() == 0 && event.gui instanceof GuiChat) {
if (ToggleCommand.chatMaddoxToggled && System.currentTimeMillis() / 1000 - lastMaddoxTime < 10) {
Minecraft.getMinecraft().thePlayer.sendChatMessage(lastMaddoxCommand);
}
}
-
- lastMouse = Mouse.getEventButton();
}
@SubscribeEvent
public void onGuiOpen(GuiOpenEvent event) {
clickInOrderSlots.clear();
+ lastChronomatronRound = 0;
+ chronomatronPattern.clear();
+ chronomatronMouseClicks = 0;
}
@SubscribeEvent
@@ -2860,6 +2870,11 @@ public class DankersSkyblockMod
GuiChest inventory = (GuiChest) event.gui;
Container containerChest = inventory.inventorySlots;
if (containerChest instanceof ContainerChest) {
+ Minecraft mc = Minecraft.getMinecraft();
+ ScaledResolution sr = new ScaledResolution(mc);
+ int guiLeft = (sr.getScaledWidth() - 176) / 2;
+ int guiTop = (sr.getScaledHeight() - 222) / 2;
+
List<Slot> invSlots = inventory.inventorySlots.inventorySlots;
String displayName = ((ContainerChest) containerChest).getLowerChestInventory().getDisplayName().getUnformattedText().trim();
int chestSize = inventory.inventorySlots.inventorySlots.size();
@@ -2969,6 +2984,39 @@ public class DankersSkyblockMod
}
}
}
+
+ if (ToggleCommand.chronomatronToggled && displayName.startsWith("Chronomatron (")) {
+ if (invSlots.size() > 48 && invSlots.get(49).getStack() != null) {
+ if (invSlots.get(49).getStack().getDisplayName().startsWith("§7Timer: §a") && invSlots.get(4).getStack() != null) {
+ int round = invSlots.get(4).getStack().stackSize;
+ int timerSeconds = Integer.parseInt(StringUtils.stripControlCodes(invSlots.get(49).getStack().getDisplayName()).replaceAll("[^\\d]", ""));
+ if (round != lastChronomatronRound && timerSeconds == round + 2) {
+ lastChronomatronRound = round;
+ for (int i = 10; i <= 43; i++) {
+ ItemStack stack = invSlots.get(i).getStack();
+ if (stack == null) continue;
+ if (stack.getItem() == Item.getItemFromBlock(Blocks.stained_hardened_clay)) {
+ chronomatronPattern.add(stack.getDisplayName());
+ break;
+ }
+ }
+ }
+ if (chronomatronMouseClicks < chronomatronPattern.size()) {
+ for (int i = 10; i <= 43; i++) {
+ ItemStack glass = invSlots.get(i).getStack();
+ if (glass == null) continue;
+ Slot glassSlot = invSlots.get(i);
+ if (glass.getDisplayName().equals(chronomatronPattern.get(chronomatronMouseClicks))) {
+ Utils.drawOnSlot(chestSize, glassSlot.xDisplayPosition, glassSlot.yDisplayPosition, 0xE540FF40);
+ }
+ }
+ }
+ } else if (invSlots.get(49).getStack().getDisplayName().equals("§aRemember the pattern!")) {
+ chronomatronMouseClicks = 0;
+ }
+ }
+ new TextRenderer(mc, String.join("\n", chronomatronPattern), (int) (guiLeft * 0.8), 10, 1);
+ }
}
}
}
diff --git a/src/main/java/me/Danker/commands/DHelpCommand.java b/src/main/java/me/Danker/commands/DHelpCommand.java
index cf27e95..332c47f 100644
--- a/src/main/java/me/Danker/commands/DHelpCommand.java
+++ b/src/main/java/me/Danker/commands/DHelpCommand.java
@@ -34,7 +34,7 @@ public class DHelpCommand extends CommandBase {
EnumChatFormatting.GOLD + " Commands, " + EnumChatFormatting.GREEN + " Keybinds.\n" +
EnumChatFormatting.GOLD + " /dhelp" + EnumChatFormatting.AQUA + " - Returns this message.\n" +
EnumChatFormatting.GOLD + " /dsm" + EnumChatFormatting.AQUA + " - Opens the GUI for Danker's Skyblock Mod.\n" +
- EnumChatFormatting.GOLD + " /toggle <gparty/coords/golden/slayercount/rngesusalerts/splitfishing/chatmaddox/spiritbearalerts/aotd/lividdagger/sceptremessages/midasstaffmessages/implosionmessages/healmessages/petcolors/dungeontimer/golemalerts/expertiselore/skill50display/outlinetext/caketimer/lowhealthnotify/lividsolver/threemanpuzzle/oruopuzzle/blazepuzzle/creeperpuzzle/waterpuzzle/tictactoepuzzle/startswithterminal/selectallterminal/itemframeonsealanterns/ultrasequencer/list>" + EnumChatFormatting.AQUA + " - Toggles features. /toggle list returns values of every toggle.\n" +
+ EnumChatFormatting.GOLD + " /toggle <gparty/coords/golden/slayercount/rngesusalerts/splitfishing/chatmaddox/spiritbearalerts/aotd/lividdagger/sceptremessages/midasstaffmessages/implosionmessages/healmessages/petcolors/dungeontimer/golemalerts/expertiselore/skill50display/outlinetext/caketimer/lowhealthnotify/lividsolver/threemanpuzzle/oruopuzzle/blazepuzzle/creeperpuzzle/waterpuzzle/tictactoepuzzle/startswithterminal/selectallterminal/itemframeonsealanterns/ultrasequencer/chronomatron/list>" + EnumChatFormatting.AQUA + " - Toggles features. /toggle list returns values of every toggle.\n" +
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/mythological/> [winter/festival/spooky/f(1-7)/session]" + EnumChatFormatting.AQUA + " - Returns loot received from slayer quests or fishing stats. /loot fishing winter returns winter sea creatures instead.\n" +
diff --git a/src/main/java/me/Danker/commands/ToggleCommand.java b/src/main/java/me/Danker/commands/ToggleCommand.java
index 589ac33..541a59a 100644
--- a/src/main/java/me/Danker/commands/ToggleCommand.java
+++ b/src/main/java/me/Danker/commands/ToggleCommand.java
@@ -62,7 +62,7 @@ public class ToggleCommand extends CommandBase implements ICommand {
"aotd/lividdagger/sceptremessages/petcolors/dungeontimer/golemalerts/expertiselore/skill50display/" +
"outlinetext/midasstaffmessages/implosionmessages/healmessages/caketimer/lowhealthnotify/" +
"lividsolver/threemanpuzzle/oruopuzzle/blazepuzzle/creeperpuzzle/waterpuzzle/tictactoepuzzle/" +
- "startswithterminal/selectallterminal/itemframeonsealanterns/ultrasequencer/list>";
+ "startswithterminal/selectallterminal/itemframeonsealanterns/ultrasequencer/chronomatron/list>";
}
@Override
@@ -80,7 +80,8 @@ public class ToggleCommand extends CommandBase implements ICommand {
"implosionmessages", "healmessages", "caketimer", "lowhealthnotify",
"lividsolver", "threemanpuzzle", "oruopuzzle", "blazepuzzle",
"creeperpuzzle", "waterpuzzle", "tictactoepuzzle", "startswithterminal",
- "selectallterminal", "itemframeonsealanterns", "ultrasequencer", "list");
+ "selectallterminal", "itemframeonsealanterns", "ultrasequencer",
+ "chronomatron", "list");
}
return null;
}
@@ -261,6 +262,10 @@ public class ToggleCommand extends CommandBase implements ICommand {
ConfigHandler.writeBooleanConfig("toggles", "UltraSequencer", ultrasequencerToggled);
player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Ultrasequencer solver has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + ultrasequencerToggled + DankersSkyblockMod.MAIN_COLOUR + "."));
break;
+ case "chronomatron":
+ chronomatronToggled = !chronomatronToggled;
+ ConfigHandler.writeBooleanConfig("toggles", "Chronomatron", chronomatronToggled);
+ player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Chronomatron solver has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + chronomatronToggled + DankersSkyblockMod.MAIN_COLOUR + "."));
case "list":
player.addChatMessage(new ChatComponentText(DankersSkyblockMod.TYPE_COLOUR + "Guild party notifications: " + DankersSkyblockMod.VALUE_COLOUR + gpartyToggled + "\n" +
DankersSkyblockMod.TYPE_COLOUR + " Coord/Angle display: " + DankersSkyblockMod.VALUE_COLOUR + coordsToggled + "\n" +
@@ -294,7 +299,8 @@ public class ToggleCommand extends CommandBase implements ICommand {
DankersSkyblockMod.TYPE_COLOUR + " Starts with letter terminal solver: " + DankersSkyblockMod.VALUE_COLOUR + startsWithToggled + "\n" +
DankersSkyblockMod.TYPE_COLOUR + " Select all color items terminal solver: " + DankersSkyblockMod.VALUE_COLOUR + selectAllToggled + "\n" +
DankersSkyblockMod.TYPE_COLOUR + " Ignore item frames on sea lanterns: " + DankersSkyblockMod.VALUE_COLOUR + itemFrameOnSeaLanternsToggled + "\n" +
- DankersSkyblockMod.TYPE_COLOUR + " Ultra sequencer solver: " + DankersSkyblockMod.VALUE_COLOUR + ultrasequencerToggled));
+ DankersSkyblockMod.TYPE_COLOUR + " Ultra sequencer solver: " + DankersSkyblockMod.VALUE_COLOUR + ultrasequencerToggled + "\n" +
+ DankersSkyblockMod.TYPE_COLOUR + " Chronomatron solver: " + DankersSkyblockMod.VALUE_COLOUR + chronomatronToggled));
break;
default:
player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0)));
diff --git a/src/main/java/me/Danker/gui/ExperimentsGui.java b/src/main/java/me/Danker/gui/ExperimentsGui.java
index 02beb22..8b19820 100644
--- a/src/main/java/me/Danker/gui/ExperimentsGui.java
+++ b/src/main/java/me/Danker/gui/ExperimentsGui.java
@@ -13,6 +13,7 @@ public class ExperimentsGui extends GuiScreen {
private GuiButton goBack;
private GuiButton ultrasequencer;
+ private GuiButton chronomatron;
@Override
public boolean doesGuiPauseGame() {
@@ -29,9 +30,11 @@ public class ExperimentsGui extends GuiScreen {
goBack = new GuiButton(0, 2, height - 30, 100, 20, "Go Back");
ultrasequencer = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Ultrasequencer Solver: " + Utils.getColouredBoolean(ToggleCommand.ultrasequencerToggled));
+ chronomatron = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Chronomatron Solver: " + Utils.getColouredBoolean(ToggleCommand.chronomatronToggled));
- this.buttonList.add(ultrasequencer);
this.buttonList.add(goBack);
+ this.buttonList.add(ultrasequencer);
+ this.buttonList.add(chronomatron);
}
@Override
@@ -48,6 +51,10 @@ public class ExperimentsGui extends GuiScreen {
ToggleCommand.ultrasequencerToggled = !ToggleCommand.ultrasequencerToggled;
ConfigHandler.writeBooleanConfig("toggles", "UltraSequencer", ToggleCommand.ultrasequencerToggled);
ultrasequencer.displayString = "Ultrasequencer Solver: " + Utils.getColouredBoolean(ToggleCommand.ultrasequencerToggled);
+ } else if (button == chronomatron) {
+ ToggleCommand.chronomatronToggled = !ToggleCommand.chronomatronToggled;
+ ConfigHandler.writeBooleanConfig("toggles", "Chronomatron", ToggleCommand.chronomatronToggled);
+ chronomatron.displayString = "Chronomatron Solver: " + Utils.getColouredBoolean(ToggleCommand.chronomatronToggled);
}
}
diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java
index c702c80..5280747 100644
--- a/src/main/java/me/Danker/handlers/ConfigHandler.java
+++ b/src/main/java/me/Danker/handlers/ConfigHandler.java
@@ -202,6 +202,7 @@ public class ConfigHandler {
if (!hasKey("toggles", "SelectAllTerminal")) writeBooleanConfig("toggles", "SelectAllTerminal", false);
if (!hasKey("toggles", "IgnoreItemFrameOnSeaLanterns")) writeBooleanConfig("toggles", "IgnoreItemFrameOnSeaLanterns", false);
if (!hasKey("toggles", "UltraSequencer")) writeBooleanConfig("toggles", "UltraSequencer", false);
+ if (!hasKey("toggles", "Chronomatron")) writeBooleanConfig("toggles", "Chronomatron", false);
if (!hasKey("api", "APIKey")) writeStringConfig("api", "APIKey", "");
@@ -444,6 +445,7 @@ public class ConfigHandler {
ToggleCommand.selectAllToggled = getBoolean("toggles", "SelectAllTerminal");
ToggleCommand.itemFrameOnSeaLanternsToggled = getBoolean("toggles", "IgnoreItemFrameOnSeaLanterns");
ToggleCommand.ultrasequencerToggled = getBoolean("toggles", "UltraSequencer");
+ ToggleCommand.chronomatronToggled = getBoolean("toggles", "Chronomatron");
String onlySlayer = getString("toggles", "BlockSlayer");
if (!onlySlayer.equals("")) {