aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorMy-Name-Is-Jeff <37018278+My-Name-Is-Jeff@users.noreply.github.com>2020-12-12 18:18:21 -0500
committerMy-Name-Is-Jeff <37018278+My-Name-Is-Jeff@users.noreply.github.com>2020-12-12 18:18:21 -0500
commit1b49ec8892a8a158c2dea99d705ae39ff7dd0a8d (patch)
treea7f132a87033c9893f4a93ed0e58f02ded585be6 /src/main
parentefa27de89b1cdaf738446837160deebb81c70331 (diff)
downloadSkyblockMod-1b49ec8892a8a158c2dea99d705ae39ff7dd0a8d.tar.gz
SkyblockMod-1b49ec8892a8a158c2dea99d705ae39ff7dd0a8d.tar.bz2
SkyblockMod-1b49ec8892a8a158c2dea99d705ae39ff7dd0a8d.zip
Block Wrong Terminal Clicks + Fixes
Blocks wrong terminal clicks Fixes bug where bind isn't swapped back after terminal
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/me/Danker/DankersSkyblockMod.java98
-rw-r--r--src/main/java/me/Danker/commands/ToggleCommand.java10
-rw-r--r--src/main/java/me/Danker/gui/PuzzleSolversGui.java9
-rw-r--r--src/main/java/me/Danker/handlers/ConfigHandler.java2
4 files changed, 115 insertions, 4 deletions
diff --git a/src/main/java/me/Danker/DankersSkyblockMod.java b/src/main/java/me/Danker/DankersSkyblockMod.java
index 64a1f5b..98a97af 100644
--- a/src/main/java/me/Danker/DankersSkyblockMod.java
+++ b/src/main/java/me/Danker/DankersSkyblockMod.java
@@ -7,6 +7,7 @@ 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;
@@ -3033,6 +3034,96 @@ public class DankersSkyblockMod
}
}
+ if (ToggleCommand.blockWrongTerminalClicksToggled && Utils.inDungeons) {
+ boolean shouldCancel = false;
+
+ if (item == null) return;
+
+ //most of these are extra but who cares
+
+ switch(inventoryName) {
+ case "Correct all the panes!":
+ shouldCancel = !StringUtils.stripControlCodes(item.getDisplayName()).startsWith("Off");
+ break;
+ case "Navigate the maze!":
+ if((item.getItem() != Item.getItemFromBlock(Blocks.stained_glass_pane))) {
+ shouldCancel = true;
+ break;
+ }
+
+ if(item.getItemDamage() != 0) {
+ shouldCancel = true;
+ break;
+ }
+
+ boolean isValid = false;
+
+ int slotIndex = mouseSlot.getSlotIndex();
+
+ if(slotIndex % 9 != 0 && slotIndex != 53) {
+ ItemStack itemStack = inventory.getStackInSlot(slotIndex + 1);
+ if(itemStack.getItemDamage() == 5) isValid = true;
+ }
+
+ if(!isValid && slotIndex % 9 != 8 && slotIndex != 0) {
+ ItemStack itemStack = inventory.getStackInSlot(slotIndex - 1);
+ if(itemStack.getItemDamage() == 5) isValid = true;
+ }
+
+ if(!isValid && slotIndex <= 44) {
+ ItemStack itemStack = inventory.getStackInSlot(slotIndex + 9);
+ if(itemStack.getItemDamage() == 5) isValid = true;
+ }
+
+ if(!isValid && slotIndex >= 9) {
+ ItemStack itemStack = inventory.getStackInSlot(slotIndex - 9);
+ if(itemStack.getItemDamage() == 5) isValid = true;
+ }
+
+ shouldCancel = !isValid;
+
+ break;
+ case "Click in order!":
+ if((item.getItem() != Item.getItemFromBlock(Blocks.stained_glass_pane))) {
+ shouldCancel = true;
+ break;
+ }
+ if(item.getItemDamage() != 14) {
+ shouldCancel = true;
+ break;
+ }
+ int needed = 0;
+ for(int i = 10; i <= 25; i++) {
+ if(i == 17 || i == 18) continue;
+ ItemStack itemStack = inventory.getStackInSlot(i);
+ if(!itemStack.getDisplayName().contains(EnumChatFormatting.GREEN.toString())) continue;
+ if(itemStack.stackSize > needed) needed = itemStack.stackSize;
+ }
+ shouldCancel = item.stackSize != needed;
+ break;
+ }
+
+ if(!shouldCancel) {
+ if(inventoryName.startsWith("What starts with:")) {
+ 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);
+
+ String itemName = StringUtils.stripControlCodes(item.getDisplayName()).toUpperCase();
+ shouldCancel = !(itemName.contains(colour) || (colour.equals("SILVER") && itemName.contains("LIGHT GRAY")) || (colour.equals("WHITE") && itemName.equals("WOOL")));
+ }
+ }
+
+ event.setCanceled(shouldCancel && !Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) && !Keyboard.isKeyDown(Keyboard.KEY_RCONTROL));
+ }
+
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;
@@ -3078,7 +3169,7 @@ public class DankersSkyblockMod
IInventory inventory = ((ContainerChest) containerChest).getLowerChestInventory();
String inventoryName = inventory.getDisplayName().getUnformattedText();
if (ToggleCommand.swapToPickBlockToggled) {
- if (inventoryName.startsWith("Chronomatron (") || inventoryName.startsWith("Superpairs (") || inventoryName.startsWith("Ultrasequencer (") || inventoryName.startsWith("What starts with:") || inventoryName.startsWith("Select all the") || inventoryName.startsWith("Harp -")) {
+ if (inventoryName.startsWith("Chronomatron (") || inventoryName.startsWith("Superpairs (") || inventoryName.startsWith("Ultrasequencer (") || inventoryName.startsWith("What starts with:") || inventoryName.startsWith("Select all the") || inventoryName.startsWith("Navigate the maze!") || inventoryName.startsWith("Correct all the panes!") || inventoryName.startsWith("Click in order!") || inventoryName.startsWith("Harp -")) {
if (!pickBlockBindSwapped) {
pickBlockBind = gameSettings.keyBindPickBlock.getKeyCode();
gameSettings.keyBindPickBlock.setKeyCode(-100);
@@ -3092,6 +3183,11 @@ public class DankersSkyblockMod
}
}
}
+ } else {
+ if (pickBlockBindSwapped) {
+ gameSettings.keyBindPickBlock.setKeyCode(pickBlockBind);
+ pickBlockBindSwapped = false;
+ }
}
clickInOrderSlots = new Slot[36];
lastChronomatronRound = 0;
diff --git a/src/main/java/me/Danker/commands/ToggleCommand.java b/src/main/java/me/Danker/commands/ToggleCommand.java
index 172411c..7612a4d 100644
--- a/src/main/java/me/Danker/commands/ToggleCommand.java
+++ b/src/main/java/me/Danker/commands/ToggleCommand.java
@@ -49,6 +49,7 @@ public class ToggleCommand extends CommandBase implements ICommand {
// Terminal Helpers
public static boolean startsWithToggled;
public static boolean selectAllToggled;
+ public static boolean blockWrongTerminalClicksToggled;
public static boolean itemFrameOnSeaLanternsToggled;
// Experiments
public static boolean ultrasequencerToggled;
@@ -67,7 +68,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/itemframeonsealanterns/ultrasequencer/chronomatron/superpairs/hidetooltipsinaddons/pickblock/list>";
+ "watchermessage/startswithterminal/selectallterminal/blockterminalclicks/itemframeonsealanterns/ultrasequencer/chronomatron/superpairs/hidetooltipsinaddons/pickblock/list>";
}
@Override
@@ -85,7 +86,7 @@ public class ToggleCommand extends CommandBase implements ICommand {
"implosionmessages", "healmessages", "caketimer", "lowhealthnotify",
"lividsolver", "stopsalvagestarred", "threemanpuzzle", "oruopuzzle", "blazepuzzle",
"creeperpuzzle", "waterpuzzle", "tictactoepuzzle", "watchermessage", "startswithterminal",
- "selectallterminal", "itemframeonsealanterns", "ultrasequencer",
+ "selectallterminal", "blockterminalclicks", "itemframeonsealanterns", "ultrasequencer",
"chronomatron", "superpairs", "hidetooltipsinaddons", "pickblock", "list");
}
return null;
@@ -267,6 +268,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 "blockterminalclicks":
+ blockWrongTerminalClicksToggled = !blockWrongTerminalClicksToggled;
+ ConfigHandler.writeBooleanConfig("toggles", "BlockTerminalClicks", blockWrongTerminalClicksToggled);
+ player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Block wrong clicks on terminals has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + blockWrongTerminalClicksToggled + DankersSkyblockMod.MAIN_COLOUR + "."));
+ break;
case "itemframeonsealanterns":
itemFrameOnSeaLanternsToggled = !itemFrameOnSeaLanternsToggled;
ConfigHandler.writeBooleanConfig("toggles", "IgnoreItemFrameOnSeaLanterns", itemFrameOnSeaLanternsToggled);
diff --git a/src/main/java/me/Danker/gui/PuzzleSolversGui.java b/src/main/java/me/Danker/gui/PuzzleSolversGui.java
index 8701563..1e0da7f 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 blockClicks;
private GuiButton itemFrameOnSeaLanterns;
public PuzzleSolversGui(int page) {
@@ -57,7 +58,8 @@ 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));
- itemFrameOnSeaLanterns = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Ignore Arrows On Sea Lanterns: " + Utils.getColouredBoolean(ToggleCommand.itemFrameOnSeaLanternsToggled));
+ 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));
switch (page) {
case 1:
@@ -72,6 +74,7 @@ public class PuzzleSolversGui extends GuiScreen {
break;
case 2:
this.buttonList.add(selectAll);
+ this.buttonList.add(blockClicks);
this.buttonList.add(itemFrameOnSeaLanterns);
this.buttonList.add(backPage);
break;
@@ -125,6 +128,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 == blockClicks) {
+ ToggleCommand.blockWrongTerminalClicksToggled = !ToggleCommand.blockWrongTerminalClicksToggled;
+ ConfigHandler.writeBooleanConfig("toggles", "BlockTerminalClicks", ToggleCommand.blockWrongTerminalClicksToggled);
+ blockClicks.displayString = "Block Wrong Clicks on Terminals: " + Utils.getColouredBoolean(ToggleCommand.blockWrongTerminalClicksToggled);
} else if (button == itemFrameOnSeaLanterns) {
ToggleCommand.itemFrameOnSeaLanternsToggled = !ToggleCommand.itemFrameOnSeaLanternsToggled;
ConfigHandler.writeBooleanConfig("toggles", "IgnoreItemFrameOnSeaLanterns", ToggleCommand.itemFrameOnSeaLanternsToggled);
diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java
index a0e446f..a447632 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", "BlockTerminalClicks")) writeBooleanConfig("toggles", "BlockTerminalClicks", false);
if (!hasKey("toggles", "IgnoreItemFrameOnSeaLanterns")) writeBooleanConfig("toggles", "IgnoreItemFrameOnSeaLanterns", false);
// Experiment Solvers
if (!hasKey("toggles", "UltraSequencer")) writeBooleanConfig("toggles", "UltraSequencer", false);
@@ -467,6 +468,7 @@ public class ConfigHandler {
ToggleCommand.ticTacToeToggled = getBoolean("toggles", "TicTacToePuzzle");
ToggleCommand.startsWithToggled = getBoolean("toggles", "StartsWithTerminal");
ToggleCommand.selectAllToggled = getBoolean("toggles", "SelectAllTerminal");
+ ToggleCommand.blockWrongTerminalClicksToggled = getBoolean("toggles", "BlockTerminalClicks");
ToggleCommand.itemFrameOnSeaLanternsToggled = getBoolean("toggles", "IgnoreItemFrameOnSeaLanterns");
// Experiment Solvers
ToggleCommand.ultrasequencerToggled = getBoolean("toggles", "UltraSequencer");