diff options
author | My-Name-Is-Jeff <37018278+My-Name-Is-Jeff@users.noreply.github.com> | 2020-12-13 15:11:47 -0500 |
---|---|---|
committer | My-Name-Is-Jeff <37018278+My-Name-Is-Jeff@users.noreply.github.com> | 2020-12-13 15:11:47 -0500 |
commit | 831ca8ac1c4cc2a1303e981dc8c8b54107b3a3d0 (patch) | |
tree | 9ef357c94062c8623c2d130c2997351d40bf0f86 /src/main/java/me | |
parent | 6b4330cc1c6e5795c4cbf17c3ccb06e4d2cfd6d6 (diff) | |
download | SkyblockMod-831ca8ac1c4cc2a1303e981dc8c8b54107b3a3d0.tar.gz SkyblockMod-831ca8ac1c4cc2a1303e981dc8c8b54107b3a3d0.tar.bz2 SkyblockMod-831ca8ac1c4cc2a1303e981dc8c8b54107b3a3d0.zip |
Add highlighter for click in order terminal
Diffstat (limited to 'src/main/java/me')
-rw-r--r-- | src/main/java/me/Danker/DankersSkyblockMod.java | 45 | ||||
-rw-r--r-- | src/main/java/me/Danker/commands/ToggleCommand.java | 12 | ||||
-rw-r--r-- | src/main/java/me/Danker/gui/PuzzleSolversGui.java | 11 | ||||
-rw-r--r-- | src/main/java/me/Danker/handlers/ConfigHandler.java | 3 |
4 files changed, 47 insertions, 24 deletions
diff --git a/src/main/java/me/Danker/DankersSkyblockMod.java b/src/main/java/me/Danker/DankersSkyblockMod.java index 409b4d5..6355835 100644 --- a/src/main/java/me/Danker/DankersSkyblockMod.java +++ b/src/main/java/me/Danker/DankersSkyblockMod.java @@ -7,7 +7,6 @@ import me.Danker.handlers.*; import me.Danker.utils.TicTacToeUtils; import me.Danker.utils.Utils; import net.minecraft.block.Block; -import net.minecraft.block.BlockColored; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.gui.Gui; @@ -127,6 +126,8 @@ public class DankersSkyblockMod static ItemStack[] experimentTableSlots = new ItemStack[54]; static int pickBlockBind; static boolean pickBlockBindSwapped = false; + static String terminalColorNeeded; + static int[] terminalNumberNeeded = new int[2]; static double dungeonStartTime = 0; static double bloodOpenTime = 0; @@ -3092,15 +3093,8 @@ public class DankersSkyblockMod shouldCancel = true; break; } - int needed = -1; - for(int i = 10; i <= 25; i++) { - if (i == 17 || i == 18) continue; - ItemStack itemStack = inventory.getStackInSlot(i); - if (itemStack == null) continue; - if (itemStack.getItem() != Item.getItemFromBlock(Blocks.stained_glass_pane)) continue; - if (itemStack.getItemDamage() != 14) continue; - if (itemStack.stackSize > needed) needed = itemStack.stackSize; - } + int needed = terminalNumberNeeded[1]; + if(needed == 0) break; shouldCancel = needed != -1 && item.stackSize != needed ; break; } @@ -3110,16 +3104,9 @@ public class DankersSkyblockMod char letter = inventoryName.charAt(inventoryName.indexOf("'") + 1); shouldCancel = !(StringUtils.stripControlCodes(item.getDisplayName()).charAt(0) == letter); } else if (inventoryName.startsWith("Select all the")) { - String colour; - List<String> colourParts = new ArrayList<>(); - Matcher colourMatcher = startsWithTerminalPattern.matcher(inventoryName); - while (colourMatcher.find()) { - colourParts.add(colourMatcher.group()); - } - colour = String.join(" ", colourParts); - + if(terminalColorNeeded == null) return; String itemName = StringUtils.stripControlCodes(item.getDisplayName()).toUpperCase(); - shouldCancel = !(itemName.contains(colour) || (colour.equals("SILVER") && itemName.contains("LIGHT GRAY")) || (colour.equals("WHITE") && itemName.equals("WOOL"))); + shouldCancel = !(itemName.contains(terminalColorNeeded) || (terminalColorNeeded.equals("SILVER") && itemName.contains("LIGHT GRAY")) || (terminalColorNeeded.equals("WHITE") && itemName.equals("WOOL"))); } } @@ -3196,6 +3183,8 @@ public class DankersSkyblockMod chronomatronPattern.clear(); chronomatronMouseClicks = 0; experimentTableSlots = new ItemStack[54]; + terminalColorNeeded = null; + terminalNumberNeeded = new int[2]; } @SubscribeEvent @@ -3270,6 +3259,7 @@ public class DankersSkyblockMod colourParts.add(colourMatcher.group()); } colour = String.join(" ", colourParts); + terminalColorNeeded = colour; for (Slot slot : invSlots) { ItemStack item = slot.getStack(); @@ -3281,6 +3271,23 @@ public class DankersSkyblockMod } } + if(ToggleCommand.clickInOrderToggled && displayName.equals("Click in order!")) { + for(int i = 10; i <= 25; i++) { + if (i == 17 || i == 18) continue; + ItemStack itemStack = invSlots.get(i).getStack(); + if (itemStack == null) continue; + if (itemStack.getItem() != Item.getItemFromBlock(Blocks.stained_glass_pane)) continue; + if (itemStack.getItemDamage() != 14) continue; + if (itemStack.stackSize > terminalNumberNeeded[0]) { + terminalNumberNeeded[0] = itemStack.stackSize; + terminalNumberNeeded[1] = i; + } + } + if(terminalNumberNeeded[0] == 0) return; + Slot slot = invSlots.get(terminalNumberNeeded[0]); + Utils.drawOnSlot(chestSize, slot.xDisplayPosition, slot.yDisplayPosition, 0xBF40FF40); + } + if (ToggleCommand.ultrasequencerToggled && displayName.startsWith("Ultrasequencer (")) { if (invSlots.size() > 48 && invSlots.get(49).getStack() != null) { if (invSlots.get(49).getStack().getDisplayName().startsWith("§7Timer: §a")) { diff --git a/src/main/java/me/Danker/commands/ToggleCommand.java b/src/main/java/me/Danker/commands/ToggleCommand.java index e4a7f02..8cad486 100644 --- a/src/main/java/me/Danker/commands/ToggleCommand.java +++ b/src/main/java/me/Danker/commands/ToggleCommand.java @@ -49,7 +49,8 @@ public class ToggleCommand extends CommandBase implements ICommand { // Terminal Helpers public static boolean startsWithToggled; public static boolean selectAllToggled; - public static boolean blockWrongTerminalClicksToggled; + public static boolean clickInOrderToggled; + public static boolean blockWrongTerminalClicksToggled; public static boolean itemFrameOnSeaLanternsToggled; // Experiments public static boolean ultrasequencerToggled; @@ -68,7 +69,7 @@ public class ToggleCommand extends CommandBase implements ICommand { "aotd/lividdagger/sceptremessages/petcolors/dungeontimer/golemalerts/expertiselore/skill50display/" + "outlinetext/midasstaffmessages/implosionmessages/healmessages/caketimer/lowhealthnotify/" + "lividsolver/stopsalvagestarred/threemanpuzzle/oruopuzzle/blazepuzzle/creeperpuzzle/waterpuzzle/tictactoepuzzle/" + - "watchermessage/startswithterminal/selectallterminal/blockwrongterminalclicks/itemframeonsealanterns/ultrasequencer/chronomatron/superpairs/hidetooltipsinaddons/pickblock/list>"; + "watchermessage/startswithterminal/selectallterminal/clickinorderterminal/blockwrongterminalclicks/itemframeonsealanterns/ultrasequencer/chronomatron/superpairs/hidetooltipsinaddons/pickblock/list>"; } @Override @@ -86,7 +87,7 @@ public class ToggleCommand extends CommandBase implements ICommand { "implosionmessages", "healmessages", "caketimer", "lowhealthnotify", "lividsolver", "stopsalvagestarred", "threemanpuzzle", "oruopuzzle", "blazepuzzle", "creeperpuzzle", "waterpuzzle", "tictactoepuzzle", "watchermessage", "startswithterminal", - "selectallterminal", "blockwrongterminalclicks", "itemframeonsealanterns", "ultrasequencer", + "selectallterminal", "clickinorderterminal", "blockwrongterminalclicks", "itemframeonsealanterns", "ultrasequencer", "chronomatron", "superpairs", "hidetooltipsinaddons", "pickblock", "list"); } return null; @@ -268,6 +269,11 @@ public class ToggleCommand extends CommandBase implements ICommand { ConfigHandler.writeBooleanConfig("toggles", "SelectAllTerminal", selectAllToggled); player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Select all color items terminal solver has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + selectAllToggled + DankersSkyblockMod.MAIN_COLOUR + ".")); break; + case "clickinorderterminal": + clickInOrderToggled = !clickInOrderToggled; + ConfigHandler.writeBooleanConfig("toggles", "ClickInOrderTerminal", clickInOrderToggled); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Click in order terminal solver has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + selectAllToggled + DankersSkyblockMod.MAIN_COLOUR + ".")); + break; case "blockwrongterminalclicks": blockWrongTerminalClicksToggled = !blockWrongTerminalClicksToggled; ConfigHandler.writeBooleanConfig("toggles", "BlockWrongTerminalClicks", blockWrongTerminalClicksToggled); diff --git a/src/main/java/me/Danker/gui/PuzzleSolversGui.java b/src/main/java/me/Danker/gui/PuzzleSolversGui.java index 0e9da2f..b7b24a3 100644 --- a/src/main/java/me/Danker/gui/PuzzleSolversGui.java +++ b/src/main/java/me/Danker/gui/PuzzleSolversGui.java @@ -24,6 +24,7 @@ public class PuzzleSolversGui extends GuiScreen { private GuiButton ticTacToe; private GuiButton startsWith; private GuiButton selectAll; + private GuiButton clickOrder; private GuiButton blockClicks; private GuiButton itemFrameOnSeaLanterns; @@ -58,8 +59,9 @@ public class PuzzleSolversGui extends GuiScreen { startsWith = new GuiButton(0, width / 2 - 100, (int) (height * 0.7), "Starts With Letter Terminal Solver: " + Utils.getColouredBoolean(ToggleCommand.startsWithToggled)); // Page 2 selectAll = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Select All Color Terminal Solver: " + Utils.getColouredBoolean(ToggleCommand.selectAllToggled)); - blockClicks = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Block Wrong Clicks on Terminals: " + Utils.getColouredBoolean(ToggleCommand.blockWrongTerminalClicksToggled)); - itemFrameOnSeaLanterns = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "Ignore Arrows On Sea Lanterns: " + Utils.getColouredBoolean(ToggleCommand.itemFrameOnSeaLanternsToggled)); + clickOrder = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Click in Order Terminal Solver: " + Utils.getColouredBoolean(ToggleCommand.clickInOrderToggled)); + blockClicks = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "Block Wrong Clicks on Terminals: " + Utils.getColouredBoolean(ToggleCommand.blockWrongTerminalClicksToggled)); + itemFrameOnSeaLanterns = new GuiButton(0, width / 2 - 100, (int) (height * 0.4), "Ignore Arrows On Sea Lanterns: " + Utils.getColouredBoolean(ToggleCommand.itemFrameOnSeaLanternsToggled)); switch (page) { case 1: @@ -74,6 +76,7 @@ public class PuzzleSolversGui extends GuiScreen { break; case 2: this.buttonList.add(selectAll); + this.buttonList.add(clickOrder); this.buttonList.add(blockClicks); this.buttonList.add(itemFrameOnSeaLanterns); this.buttonList.add(backPage); @@ -128,6 +131,10 @@ public class PuzzleSolversGui extends GuiScreen { ToggleCommand.selectAllToggled = !ToggleCommand.selectAllToggled; ConfigHandler.writeBooleanConfig("toggles", "SelectAllTerminal", ToggleCommand.selectAllToggled); selectAll.displayString = "Select All Color Terminal Solver: " + Utils.getColouredBoolean(ToggleCommand.selectAllToggled); + } else if (button == clickOrder) { + ToggleCommand.clickInOrderToggled = !ToggleCommand.clickInOrderToggled; + ConfigHandler.writeBooleanConfig("toggles", "ClickInOrderTerminal", ToggleCommand.clickInOrderToggled); + clickOrder.displayString = "Click in Order Terminal Solver: " + Utils.getColouredBoolean(ToggleCommand.clickInOrderToggled); } else if (button == blockClicks) { ToggleCommand.blockWrongTerminalClicksToggled = !ToggleCommand.blockWrongTerminalClicksToggled; ConfigHandler.writeBooleanConfig("toggles", "BlockWrongTerminalClicks", ToggleCommand.blockWrongTerminalClicksToggled); diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java index 93da3e8..1955ba4 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -203,6 +203,7 @@ public class ConfigHandler { if (!hasKey("toggles", "TicTacToePuzzle")) writeBooleanConfig("toggles", "TicTacToePuzzle", false); if (!hasKey("toggles", "StartsWithTerminal")) writeBooleanConfig("toggles", "StartsWithTerminal", false); if (!hasKey("toggles", "SelectAllTerminal")) writeBooleanConfig("toggles", "SelectAllTerminal", false); + if (!hasKey("toggles", "ClickInOrderTerminal")) writeBooleanConfig("toggles", "ClickInOrderTerminal", false); if (!hasKey("toggles", "BlockWrongTerminalClicks")) writeBooleanConfig("toggles", "BlockWrongTerminalClicks", false); if (!hasKey("toggles", "IgnoreItemFrameOnSeaLanterns")) writeBooleanConfig("toggles", "IgnoreItemFrameOnSeaLanterns", false); // Experiment Solvers @@ -468,6 +469,8 @@ public class ConfigHandler { ToggleCommand.ticTacToeToggled = getBoolean("toggles", "TicTacToePuzzle"); ToggleCommand.startsWithToggled = getBoolean("toggles", "StartsWithTerminal"); ToggleCommand.selectAllToggled = getBoolean("toggles", "SelectAllTerminal"); + ToggleCommand.clickInOrderToggled = getBoolean("toggles", "ClickInOrderTerminal"); + ToggleCommand.blockWrongTerminalClicksToggled = getBoolean("toggles", "BlockWrongTerminalClicks"); ToggleCommand.itemFrameOnSeaLanternsToggled = getBoolean("toggles", "IgnoreItemFrameOnSeaLanterns"); // Experiment Solvers |