From 1b49ec8892a8a158c2dea99d705ae39ff7dd0a8d Mon Sep 17 00:00:00 2001 From: My-Name-Is-Jeff <37018278+My-Name-Is-Jeff@users.noreply.github.com> Date: Sat, 12 Dec 2020 18:18:21 -0500 Subject: Block Wrong Terminal Clicks + Fixes Blocks wrong terminal clicks Fixes bug where bind isn't swapped back after terminal --- src/main/java/me/Danker/DankersSkyblockMod.java | 98 +++++++++++++++++++++- .../java/me/Danker/commands/ToggleCommand.java | 10 ++- src/main/java/me/Danker/gui/PuzzleSolversGui.java | 9 +- .../java/me/Danker/handlers/ConfigHandler.java | 2 + 4 files changed, 115 insertions(+), 4 deletions(-) (limited to 'src/main') 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 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"); -- cgit From d2b60152ae3a0a4e63732e231e49373f29cce1f9 Mon Sep 17 00:00:00 2001 From: My-Name-Is-Jeff <37018278+My-Name-Is-Jeff@users.noreply.github.com> Date: Sat, 12 Dec 2020 18:41:06 -0500 Subject: Update Wording --- src/main/java/me/Danker/commands/ToggleCommand.java | 8 ++++---- src/main/java/me/Danker/gui/PuzzleSolversGui.java | 2 +- src/main/java/me/Danker/handlers/ConfigHandler.java | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src/main') diff --git a/src/main/java/me/Danker/commands/ToggleCommand.java b/src/main/java/me/Danker/commands/ToggleCommand.java index 7612a4d..e4a7f02 100644 --- a/src/main/java/me/Danker/commands/ToggleCommand.java +++ b/src/main/java/me/Danker/commands/ToggleCommand.java @@ -68,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/blockterminalclicks/itemframeonsealanterns/ultrasequencer/chronomatron/superpairs/hidetooltipsinaddons/pickblock/list>"; + "watchermessage/startswithterminal/selectallterminal/blockwrongterminalclicks/itemframeonsealanterns/ultrasequencer/chronomatron/superpairs/hidetooltipsinaddons/pickblock/list>"; } @Override @@ -86,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", "blockterminalclicks", "itemframeonsealanterns", "ultrasequencer", + "selectallterminal", "blockwrongterminalclicks", "itemframeonsealanterns", "ultrasequencer", "chronomatron", "superpairs", "hidetooltipsinaddons", "pickblock", "list"); } return null; @@ -268,9 +268,9 @@ 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": + case "blockwrongterminalclicks": blockWrongTerminalClicksToggled = !blockWrongTerminalClicksToggled; - ConfigHandler.writeBooleanConfig("toggles", "BlockTerminalClicks", blockWrongTerminalClicksToggled); + ConfigHandler.writeBooleanConfig("toggles", "BlockWrongTerminalClicks", 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": diff --git a/src/main/java/me/Danker/gui/PuzzleSolversGui.java b/src/main/java/me/Danker/gui/PuzzleSolversGui.java index 1e0da7f..0e9da2f 100644 --- a/src/main/java/me/Danker/gui/PuzzleSolversGui.java +++ b/src/main/java/me/Danker/gui/PuzzleSolversGui.java @@ -130,7 +130,7 @@ public class PuzzleSolversGui extends GuiScreen { 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); + ConfigHandler.writeBooleanConfig("toggles", "BlockWrongTerminalClicks", ToggleCommand.blockWrongTerminalClicksToggled); blockClicks.displayString = "Block Wrong Clicks on Terminals: " + Utils.getColouredBoolean(ToggleCommand.blockWrongTerminalClicksToggled); } else if (button == itemFrameOnSeaLanterns) { ToggleCommand.itemFrameOnSeaLanternsToggled = !ToggleCommand.itemFrameOnSeaLanternsToggled; diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java index a447632..93da3e8 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -203,7 +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", "BlockWrongTerminalClicks")) writeBooleanConfig("toggles", "BlockWrongTerminalClicks", false); if (!hasKey("toggles", "IgnoreItemFrameOnSeaLanterns")) writeBooleanConfig("toggles", "IgnoreItemFrameOnSeaLanterns", false); // Experiment Solvers if (!hasKey("toggles", "UltraSequencer")) writeBooleanConfig("toggles", "UltraSequencer", false); @@ -468,7 +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.blockWrongTerminalClicksToggled = getBoolean("toggles", "BlockWrongTerminalClicks"); ToggleCommand.itemFrameOnSeaLanternsToggled = getBoolean("toggles", "IgnoreItemFrameOnSeaLanterns"); // Experiment Solvers ToggleCommand.ultrasequencerToggled = getBoolean("toggles", "UltraSequencer"); -- cgit From f4e0781601e2a55bfdb6da74fbe2fe07193890c1 Mon Sep 17 00:00:00 2001 From: My-Name-Is-Jeff <37018278+My-Name-Is-Jeff@users.noreply.github.com> Date: Sat, 12 Dec 2020 18:59:27 -0500 Subject: Fix NullPointerException --- src/main/java/me/Danker/DankersSkyblockMod.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/main') diff --git a/src/main/java/me/Danker/DankersSkyblockMod.java b/src/main/java/me/Danker/DankersSkyblockMod.java index 98a97af..ad5106f 100644 --- a/src/main/java/me/Danker/DankersSkyblockMod.java +++ b/src/main/java/me/Danker/DankersSkyblockMod.java @@ -3062,22 +3062,22 @@ public class DankersSkyblockMod if(slotIndex % 9 != 0 && slotIndex != 53) { ItemStack itemStack = inventory.getStackInSlot(slotIndex + 1); - if(itemStack.getItemDamage() == 5) isValid = true; + if(itemStack != null && 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(itemStack != null && itemStack.getItemDamage() == 5) isValid = true; } if(!isValid && slotIndex <= 44) { ItemStack itemStack = inventory.getStackInSlot(slotIndex + 9); - if(itemStack.getItemDamage() == 5) isValid = true; + if(itemStack != null && itemStack.getItemDamage() == 5) isValid = true; } if(!isValid && slotIndex >= 9) { ItemStack itemStack = inventory.getStackInSlot(slotIndex - 9); - if(itemStack.getItemDamage() == 5) isValid = true; + if(itemStack != null && itemStack.getItemDamage() == 5) isValid = true; } shouldCancel = !isValid; -- cgit From c302e2b7ed4dd4d949f9ccff0536be8aa33e4ce8 Mon Sep 17 00:00:00 2001 From: My-Name-Is-Jeff <37018278+My-Name-Is-Jeff@users.noreply.github.com> Date: Sun, 13 Dec 2020 14:40:43 -0500 Subject: Fixed a swapped order --- src/main/java/me/Danker/DankersSkyblockMod.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/main') diff --git a/src/main/java/me/Danker/DankersSkyblockMod.java b/src/main/java/me/Danker/DankersSkyblockMod.java index ad5106f..982ed0d 100644 --- a/src/main/java/me/Danker/DankersSkyblockMod.java +++ b/src/main/java/me/Danker/DankersSkyblockMod.java @@ -3060,12 +3060,12 @@ public class DankersSkyblockMod int slotIndex = mouseSlot.getSlotIndex(); - if(slotIndex % 9 != 0 && slotIndex != 53) { + if(slotIndex % 9 != 8 && slotIndex != 53) { ItemStack itemStack = inventory.getStackInSlot(slotIndex + 1); if(itemStack != null && itemStack.getItemDamage() == 5) isValid = true; } - if(!isValid && slotIndex % 9 != 8 && slotIndex != 0) { + if(!isValid && slotIndex % 9 != 0 && slotIndex != 0) { ItemStack itemStack = inventory.getStackInSlot(slotIndex - 1); if(itemStack != null && itemStack.getItemDamage() == 5) isValid = true; } @@ -3092,14 +3092,13 @@ public class DankersSkyblockMod shouldCancel = true; break; } - int needed = 0; + int needed = -1; 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; + shouldCancel = needed != -1 && item.stackSize != needed ; break; } -- cgit From 6b4330cc1c6e5795c4cbf17c3ccb06e4d2cfd6d6 Mon Sep 17 00:00:00 2001 From: My-Name-Is-Jeff <37018278+My-Name-Is-Jeff@users.noreply.github.com> Date: Sun, 13 Dec 2020 14:44:27 -0500 Subject: Fix click blocking for "click in order" --- src/main/java/me/Danker/DankersSkyblockMod.java | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'src/main') diff --git a/src/main/java/me/Danker/DankersSkyblockMod.java b/src/main/java/me/Danker/DankersSkyblockMod.java index 982ed0d..409b4d5 100644 --- a/src/main/java/me/Danker/DankersSkyblockMod.java +++ b/src/main/java/me/Danker/DankersSkyblockMod.java @@ -3041,17 +3041,17 @@ public class DankersSkyblockMod //most of these are extra but who cares - switch(inventoryName) { + 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))) { + if (item.getItem() != Item.getItemFromBlock(Blocks.stained_glass_pane)) { shouldCancel = true; break; } - if(item.getItemDamage() != 0) { + if (item.getItemDamage() != 0) { shouldCancel = true; break; } @@ -3060,12 +3060,12 @@ public class DankersSkyblockMod int slotIndex = mouseSlot.getSlotIndex(); - if(slotIndex % 9 != 8 && slotIndex != 53) { + if (slotIndex % 9 != 8 && slotIndex != 53) { ItemStack itemStack = inventory.getStackInSlot(slotIndex + 1); if(itemStack != null && itemStack.getItemDamage() == 5) isValid = true; } - if(!isValid && slotIndex % 9 != 0 && slotIndex != 0) { + if (!isValid && slotIndex % 9 != 0 && slotIndex != 0) { ItemStack itemStack = inventory.getStackInSlot(slotIndex - 1); if(itemStack != null && itemStack.getItemDamage() == 5) isValid = true; } @@ -3094,19 +3094,22 @@ public class DankersSkyblockMod } int needed = -1; for(int i = 10; i <= 25; i++) { - if(i == 17 || i == 18) continue; + if (i == 17 || i == 18) continue; ItemStack itemStack = inventory.getStackInSlot(i); - if(itemStack.stackSize > needed) needed = itemStack.stackSize; + 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; } shouldCancel = needed != -1 && item.stackSize != needed ; break; } - if(!shouldCancel) { - if(inventoryName.startsWith("What starts with:")) { + 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")) { + } else if (inventoryName.startsWith("Select all the")) { String colour; List colourParts = new ArrayList<>(); Matcher colourMatcher = startsWithTerminalPattern.matcher(inventoryName); -- cgit From 831ca8ac1c4cc2a1303e981dc8c8b54107b3a3d0 Mon Sep 17 00:00:00 2001 From: My-Name-Is-Jeff <37018278+My-Name-Is-Jeff@users.noreply.github.com> Date: Sun, 13 Dec 2020 15:11:47 -0500 Subject: Add highlighter for click in order terminal --- src/main/java/me/Danker/DankersSkyblockMod.java | 45 +++++++++++++--------- .../java/me/Danker/commands/ToggleCommand.java | 12 ++++-- src/main/java/me/Danker/gui/PuzzleSolversGui.java | 11 +++++- .../java/me/Danker/handlers/ConfigHandler.java | 3 ++ 4 files changed, 47 insertions(+), 24 deletions(-) (limited to 'src/main') 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 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 -- cgit From eb5821def8792780faa13f29a890d9894671a8b4 Mon Sep 17 00:00:00 2001 From: My-Name-Is-Jeff <37018278+My-Name-Is-Jeff@users.noreply.github.com> Date: Sun, 13 Dec 2020 15:19:19 -0500 Subject: Rename click in order to helper --- src/main/java/me/Danker/commands/ToggleCommand.java | 2 +- src/main/java/me/Danker/gui/PuzzleSolversGui.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/main') diff --git a/src/main/java/me/Danker/commands/ToggleCommand.java b/src/main/java/me/Danker/commands/ToggleCommand.java index 8cad486..2e43ba8 100644 --- a/src/main/java/me/Danker/commands/ToggleCommand.java +++ b/src/main/java/me/Danker/commands/ToggleCommand.java @@ -272,7 +272,7 @@ public class ToggleCommand extends CommandBase implements ICommand { 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 + ".")); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Click in order terminal helper has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + selectAllToggled + DankersSkyblockMod.MAIN_COLOUR + ".")); break; case "blockwrongterminalclicks": blockWrongTerminalClicksToggled = !blockWrongTerminalClicksToggled; diff --git a/src/main/java/me/Danker/gui/PuzzleSolversGui.java b/src/main/java/me/Danker/gui/PuzzleSolversGui.java index b7b24a3..17eb433 100644 --- a/src/main/java/me/Danker/gui/PuzzleSolversGui.java +++ b/src/main/java/me/Danker/gui/PuzzleSolversGui.java @@ -59,7 +59,7 @@ 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)); - clickOrder = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Click in Order Terminal Solver: " + Utils.getColouredBoolean(ToggleCommand.clickInOrderToggled)); + clickOrder = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Click in Order Terminal Helper: " + 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)); @@ -134,7 +134,7 @@ public class PuzzleSolversGui extends GuiScreen { } 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); + clickOrder.displayString = "Click in Order Terminal Helper: " + Utils.getColouredBoolean(ToggleCommand.clickInOrderToggled); } else if (button == blockClicks) { ToggleCommand.blockWrongTerminalClicksToggled = !ToggleCommand.blockWrongTerminalClicksToggled; ConfigHandler.writeBooleanConfig("toggles", "BlockWrongTerminalClicks", ToggleCommand.blockWrongTerminalClicksToggled); -- cgit From 2943d1386abb2eda3073df389d99e23bf9691182 Mon Sep 17 00:00:00 2001 From: My-Name-Is-Jeff <37018278+My-Name-Is-Jeff@users.noreply.github.com> Date: Sun, 13 Dec 2020 15:20:25 -0500 Subject: Update DHelpCommand.java --- src/main/java/me/Danker/commands/DHelpCommand.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main') diff --git a/src/main/java/me/Danker/commands/DHelpCommand.java b/src/main/java/me/Danker/commands/DHelpCommand.java index 395f40d..66d8bd8 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 " + EnumChatFormatting.AQUA + " - Toggles features. /toggle list returns values of every toggle.\n" + + EnumChatFormatting.GOLD + " /toggle " + EnumChatFormatting.AQUA + " - Toggles features. /toggle list returns values of every toggle.\n" + EnumChatFormatting.GOLD + " /setkey " + 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 [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" + -- cgit From 2d899b43f78bf15b697de0335b7b9bd3a161669a Mon Sep 17 00:00:00 2001 From: My-Name-Is-Jeff <37018278+My-Name-Is-Jeff@users.noreply.github.com> Date: Sun, 13 Dec 2020 15:21:44 -0500 Subject: Update debug --- src/main/java/me/Danker/commands/DankerGuiCommand.java | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/main') diff --git a/src/main/java/me/Danker/commands/DankerGuiCommand.java b/src/main/java/me/Danker/commands/DankerGuiCommand.java index b10980f..1281dd3 100644 --- a/src/main/java/me/Danker/commands/DankerGuiCommand.java +++ b/src/main/java/me/Danker/commands/DankerGuiCommand.java @@ -66,6 +66,8 @@ public class DankerGuiCommand extends CommandBase { debug.append("[tictactoepuzzle][").append(ToggleCommand.ticTacToeToggled).append("]\n"); debug.append("[startswithterminal][").append(ToggleCommand.startsWithToggled).append("]\n"); debug.append("[selectallterminal][").append(ToggleCommand.selectAllToggled).append("]\n"); + debug.append("[clickinorderterminal][").append(ToggleCommand.clickInOrderToggled).append("]\n"); + debug.append("[blockwrongterminalclicks][").append(ToggleCommand.blockWrongTerminalClicksToggled).append("]\n"); debug.append("[itemframeonsealanterns][").append(ToggleCommand.itemFrameOnSeaLanternsToggled).append("]\n"); debug.append("[ultrasequencer][").append(ToggleCommand.ultrasequencerToggled).append("]\n"); debug.append("[chronomatron][").append(ToggleCommand.chronomatronToggled).append("]\n"); -- cgit From 6e435b5595ea5752d5933bc908971ebcc92e165b Mon Sep 17 00:00:00 2001 From: My-Name-Is-Jeff <37018278+My-Name-Is-Jeff@users.noreply.github.com> Date: Sun, 13 Dec 2020 18:05:12 -0500 Subject: Fix Click in Order Helper --- src/main/java/me/Danker/DankersSkyblockMod.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/main') diff --git a/src/main/java/me/Danker/DankersSkyblockMod.java b/src/main/java/me/Danker/DankersSkyblockMod.java index 6355835..0dec910 100644 --- a/src/main/java/me/Danker/DankersSkyblockMod.java +++ b/src/main/java/me/Danker/DankersSkyblockMod.java @@ -3093,7 +3093,7 @@ public class DankersSkyblockMod shouldCancel = true; break; } - int needed = terminalNumberNeeded[1]; + int needed = terminalNumberNeeded[0]; if(needed == 0) break; shouldCancel = needed != -1 && item.stackSize != needed ; break; @@ -3278,13 +3278,13 @@ public class DankersSkyblockMod if (itemStack == null) continue; if (itemStack.getItem() != Item.getItemFromBlock(Blocks.stained_glass_pane)) continue; if (itemStack.getItemDamage() != 14) continue; - if (itemStack.stackSize > terminalNumberNeeded[0]) { + if (itemStack.stackSize < terminalNumberNeeded[0]) { terminalNumberNeeded[0] = itemStack.stackSize; terminalNumberNeeded[1] = i; } } if(terminalNumberNeeded[0] == 0) return; - Slot slot = invSlots.get(terminalNumberNeeded[0]); + Slot slot = invSlots.get(terminalNumberNeeded[1]); Utils.drawOnSlot(chestSize, slot.xDisplayPosition, slot.yDisplayPosition, 0xBF40FF40); } -- cgit From e8bb59a78708fe82893fb49dc4e5acd7a96c2979 Mon Sep 17 00:00:00 2001 From: My-Name-Is-Jeff <37018278+My-Name-Is-Jeff@users.noreply.github.com> Date: Sun, 13 Dec 2020 18:29:50 -0500 Subject: Notify when Slayer Slain --- src/main/java/me/Danker/DankersSkyblockMod.java | 19 +++++++++++++++++++ src/main/java/me/Danker/commands/DHelpCommand.java | 2 +- .../java/me/Danker/commands/DankerGuiCommand.java | 1 + src/main/java/me/Danker/commands/ToggleCommand.java | 10 ++++++++-- src/main/java/me/Danker/gui/DankerGui.java | 8 ++++++++ src/main/java/me/Danker/handlers/ConfigHandler.java | 2 ++ 6 files changed, 39 insertions(+), 3 deletions(-) (limited to 'src/main') diff --git a/src/main/java/me/Danker/DankersSkyblockMod.java b/src/main/java/me/Danker/DankersSkyblockMod.java index 0dec910..fa06360 100644 --- a/src/main/java/me/Danker/DankersSkyblockMod.java +++ b/src/main/java/me/Danker/DankersSkyblockMod.java @@ -18,6 +18,9 @@ import net.minecraft.client.settings.KeyBinding; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityItemFrame; import net.minecraft.entity.monster.EntityCreeper; +import net.minecraft.entity.monster.EntitySpider; +import net.minecraft.entity.monster.EntityZombie; +import net.minecraft.entity.passive.EntityWolf; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.event.ClickEvent; import net.minecraft.event.ClickEvent.Action; @@ -40,6 +43,7 @@ import net.minecraftforge.client.event.*; import net.minecraftforge.client.event.sound.PlaySoundEvent; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.EntityJoinWorldEvent; +import net.minecraftforge.event.entity.player.AttackEntityEvent; import net.minecraftforge.event.entity.player.EntityInteractEvent; import net.minecraftforge.event.entity.player.ItemTooltipEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent; @@ -2878,6 +2882,21 @@ public class DankersSkyblockMod } } + @SubscribeEvent + public void onAttackingEntity(AttackEntityEvent event) { + if (ToggleCommand.notifySlayerSlainToggled && (event.target instanceof EntityZombie || event.target instanceof EntitySpider || event.target instanceof EntityWolf)) { + List scoreboard = ScoreboardHandler.getSidebarLines(); + + for (String line : scoreboard) { + String cleanedLine = ScoreboardHandler.cleanSB(line); + if (cleanedLine.contains("Boss slain!")) { + Utils.createTitle(EnumChatFormatting.RED + "Boss slain!", 2); + break; + } + } + } + } + @SubscribeEvent public void onEntityInteract(EntityInteractEvent event) { Minecraft mc = Minecraft.getMinecraft(); diff --git a/src/main/java/me/Danker/commands/DHelpCommand.java b/src/main/java/me/Danker/commands/DHelpCommand.java index 66d8bd8..b2f6824 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 " + EnumChatFormatting.AQUA + " - Toggles features. /toggle list returns values of every toggle.\n" + + EnumChatFormatting.GOLD + " /toggle " + EnumChatFormatting.AQUA + " - Toggles features. /toggle list returns values of every toggle.\n" + EnumChatFormatting.GOLD + " /setkey " + 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 [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/DankerGuiCommand.java b/src/main/java/me/Danker/commands/DankerGuiCommand.java index 1281dd3..7c9c2f0 100644 --- a/src/main/java/me/Danker/commands/DankerGuiCommand.java +++ b/src/main/java/me/Danker/commands/DankerGuiCommand.java @@ -58,6 +58,7 @@ public class DankerGuiCommand extends CommandBase { debug.append("[lowhealthnotify][").append(ToggleCommand.lowHealthNotifyToggled).append("]\n"); debug.append("[lividsolver][").append(ToggleCommand.lividSolverToggled).append("]\n"); debug.append("[stopsalvagestarred][").append(ToggleCommand.stopSalvageStarredToggled).append("]\n"); + debug.append("[notifyslayerslain][").append(ToggleCommand.notifySlayerSlainToggled).append("]\n"); debug.append("[threemanpuzzle][").append(ToggleCommand.threeManToggled).append("]\n"); debug.append("[oruopuzzle][").append(ToggleCommand.oruoToggled).append("]\n"); debug.append("[blazepuzzle][").append(ToggleCommand.blazeToggled).append("]\n"); diff --git a/src/main/java/me/Danker/commands/ToggleCommand.java b/src/main/java/me/Danker/commands/ToggleCommand.java index 2e43ba8..3b1c04d 100644 --- a/src/main/java/me/Danker/commands/ToggleCommand.java +++ b/src/main/java/me/Danker/commands/ToggleCommand.java @@ -39,6 +39,7 @@ public class ToggleCommand extends CommandBase implements ICommand { public static boolean stopSalvageStarredToggled; public static boolean watcherReadyToggled; public static boolean swapToPickBlockToggled; + public static boolean notifySlayerSlainToggled; // Puzzle Solvers public static boolean threeManToggled; public static boolean oruoToggled; @@ -68,7 +69,7 @@ public class ToggleCommand extends CommandBase implements ICommand { return "/" + getCommandName() + " "; } @@ -85,7 +86,7 @@ public class ToggleCommand extends CommandBase implements ICommand { "sceptremessages", "petcolors", "dungeontimer", "golemalerts", "expertiselore", "skill50display", "outlinetext", "midasstaffmessages", "implosionmessages", "healmessages", "caketimer", "lowhealthnotify", - "lividsolver", "stopsalvagestarred", "threemanpuzzle", "oruopuzzle", "blazepuzzle", + "lividsolver", "stopsalvagestarred", "notifyslayerslain", "threemanpuzzle", "oruopuzzle", "blazepuzzle", "creeperpuzzle", "waterpuzzle", "tictactoepuzzle", "watchermessage", "startswithterminal", "selectallterminal", "clickinorderterminal", "blockwrongterminalclicks", "itemframeonsealanterns", "ultrasequencer", "chronomatron", "superpairs", "hidetooltipsinaddons", "pickblock", "list"); @@ -224,6 +225,11 @@ public class ToggleCommand extends CommandBase implements ICommand { ConfigHandler.writeBooleanConfig("toggles", "StopSalvageStarred", stopSalvageStarredToggled); player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Stop salvaging starred items has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + stopSalvageStarredToggled + DankersSkyblockMod.MAIN_COLOUR + ".")); break; + case "notifyslayerslain": + notifySlayerSlainToggled = !notifySlayerSlainToggled; + ConfigHandler.writeBooleanConfig("toggles", "NotifySlayerSlain", notifySlayerSlainToggled); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Notify when slayer slain has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + notifySlayerSlainToggled + DankersSkyblockMod.MAIN_COLOUR + ".")); + break; case "threemanpuzzle": threeManToggled = !threeManToggled; ConfigHandler.writeBooleanConfig("toggles", "ThreeManPuzzle", threeManToggled); diff --git a/src/main/java/me/Danker/gui/DankerGui.java b/src/main/java/me/Danker/gui/DankerGui.java index 613e968..32c387b 100644 --- a/src/main/java/me/Danker/gui/DankerGui.java +++ b/src/main/java/me/Danker/gui/DankerGui.java @@ -56,6 +56,7 @@ public class DankerGui extends GuiScreen { private GuiButton stopSalvageStarred; private GuiButton watcherReadyMessage; private GuiButton pickBlock; + private GuiButton notifySlayerSlain; public DankerGui(int page) { this.page = page; @@ -117,6 +118,8 @@ public class DankerGui extends GuiScreen { stopSalvageStarred = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Stop Salvaging Starred Items: " + Utils.getColouredBoolean(ToggleCommand.stopSalvageStarredToggled)); watcherReadyMessage = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Display Watcher Ready Message: " + Utils.getColouredBoolean(ToggleCommand.watcherReadyToggled)); splitFishing = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "Split Fishing Display: " + Utils.getColouredBoolean(ToggleCommand.splitFishing)); + notifySlayerSlain = new GuiButton(0, width / 2 - 100, (int) (height * 0.4), "Notify when Slayer Slain: " + Utils.getColouredBoolean(ToggleCommand.notifySlayerSlainToggled)); + switch (page) { case 1: this.buttonList.add(changeDisplay); @@ -165,6 +168,7 @@ public class DankerGui extends GuiScreen { this.buttonList.add(stopSalvageStarred); this.buttonList.add(watcherReadyMessage); this.buttonList.add(splitFishing); + this.buttonList.add(notifySlayerSlain); this.buttonList.add(backPage); break; } @@ -313,6 +317,10 @@ public class DankerGui extends GuiScreen { ToggleCommand.watcherReadyToggled = !ToggleCommand.watcherReadyToggled; ConfigHandler.writeBooleanConfig("toggles", "WatcherReadyMessage", ToggleCommand.watcherReadyToggled); watcherReadyMessage.displayString = "Display Watcher Ready Message: " + Utils.getColouredBoolean(ToggleCommand.watcherReadyToggled); + } else if (button == notifySlayerSlain) { + ToggleCommand.notifySlayerSlainToggled = !ToggleCommand.notifySlayerSlainToggled; + ConfigHandler.writeBooleanConfig("toggles", "NotifySlayerSlain", ToggleCommand.notifySlayerSlainToggled); + watcherReadyMessage.displayString = "Notify when Slayer Slain: " + Utils.getColouredBoolean(ToggleCommand.notifySlayerSlainToggled); } else if (button == pickBlock) { ToggleCommand.swapToPickBlockToggled = !ToggleCommand.swapToPickBlockToggled; ConfigHandler.writeBooleanConfig("toggles", "PickBlock", ToggleCommand.swapToPickBlockToggled); diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java index 1955ba4..531d631 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -194,6 +194,7 @@ public class ConfigHandler { if (!hasKey("toggles", "StopSalvageStarred")) writeBooleanConfig("toggles", "StopSalvageStarred", false); if (!hasKey("toggles", "WatcherReadyMessage")) writeBooleanConfig("toggles", "WatcherReadyMessage", false); if (!hasKey("toggles", "PickBlock")) writeBooleanConfig("toggles", "PickBlock", false); + if (!hasKey("toggles", "NotifySlayerSlain")) writeBooleanConfig("toggles", "NotifySlayerSlain", false); // Puzzle Solvers if (!hasKey("toggles", "ThreeManPuzzle")) writeBooleanConfig("toggles", "ThreeManPuzzle", false); if (!hasKey("toggles", "OruoPuzzle")) writeBooleanConfig("toggles", "OruoPuzzle", false); @@ -459,6 +460,7 @@ public class ConfigHandler { ToggleCommand.lividSolverToggled = getBoolean("toggles", "LividSolver"); ToggleCommand.stopSalvageStarredToggled = getBoolean("toggles", "StopSalvageStarred"); ToggleCommand.watcherReadyToggled = getBoolean("toggles", "WatcherReadyMessage"); + ToggleCommand.notifySlayerSlainToggled = getBoolean("toggles", "NotifySlayerSlain"); ToggleCommand.swapToPickBlockToggled = getBoolean("toggles", "PickBlock"); // Puzzle Solvers ToggleCommand.threeManToggled = getBoolean("toggles", "ThreeManPuzzle"); -- cgit From bf431c05fa24157930ee13a59ec191c1103f31b0 Mon Sep 17 00:00:00 2001 From: My-Name-Is-Jeff <37018278+My-Name-Is-Jeff@users.noreply.github.com> Date: Sun, 13 Dec 2020 19:15:48 -0500 Subject: Update DankerGui.java wrong button lmao --- src/main/java/me/Danker/gui/DankerGui.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main') diff --git a/src/main/java/me/Danker/gui/DankerGui.java b/src/main/java/me/Danker/gui/DankerGui.java index 32c387b..ff6d5d0 100644 --- a/src/main/java/me/Danker/gui/DankerGui.java +++ b/src/main/java/me/Danker/gui/DankerGui.java @@ -320,7 +320,7 @@ public class DankerGui extends GuiScreen { } else if (button == notifySlayerSlain) { ToggleCommand.notifySlayerSlainToggled = !ToggleCommand.notifySlayerSlainToggled; ConfigHandler.writeBooleanConfig("toggles", "NotifySlayerSlain", ToggleCommand.notifySlayerSlainToggled); - watcherReadyMessage.displayString = "Notify when Slayer Slain: " + Utils.getColouredBoolean(ToggleCommand.notifySlayerSlainToggled); + notifySlayerSlain.displayString = "Notify when Slayer Slain: " + Utils.getColouredBoolean(ToggleCommand.notifySlayerSlainToggled); } else if (button == pickBlock) { ToggleCommand.swapToPickBlockToggled = !ToggleCommand.swapToPickBlockToggled; ConfigHandler.writeBooleanConfig("toggles", "PickBlock", ToggleCommand.swapToPickBlockToggled); -- cgit From 66f06282dd87ed10f9fc6a0242efc9312ab38279 Mon Sep 17 00:00:00 2001 From: My-Name-Is-Jeff <37018278+My-Name-Is-Jeff@users.noreply.github.com> Date: Sun, 13 Dec 2020 20:20:25 -0500 Subject: Actually fixed it (hopefully) --- src/main/java/me/Danker/DankersSkyblockMod.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/main') diff --git a/src/main/java/me/Danker/DankersSkyblockMod.java b/src/main/java/me/Danker/DankersSkyblockMod.java index fa06360..01f7f23 100644 --- a/src/main/java/me/Danker/DankersSkyblockMod.java +++ b/src/main/java/me/Danker/DankersSkyblockMod.java @@ -3296,9 +3296,9 @@ public class DankersSkyblockMod 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; + if (itemStack.getItemDamage() != 5) continue; + if (itemStack.stackSize >= terminalNumberNeeded[0]) { + terminalNumberNeeded[0] = itemStack.stackSize + 1; terminalNumberNeeded[1] = i; } } -- cgit From 66a55e022de9af8eb5ae61aff69e18037e4f91ee Mon Sep 17 00:00:00 2001 From: My-Name-Is-Jeff <37018278+My-Name-Is-Jeff@users.noreply.github.com> Date: Sun, 13 Dec 2020 21:38:14 -0500 Subject: Stop highlighting already chosen items on terminals --- src/main/java/me/Danker/DankersSkyblockMod.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/main') diff --git a/src/main/java/me/Danker/DankersSkyblockMod.java b/src/main/java/me/Danker/DankersSkyblockMod.java index 01f7f23..5fc820e 100644 --- a/src/main/java/me/Danker/DankersSkyblockMod.java +++ b/src/main/java/me/Danker/DankersSkyblockMod.java @@ -3264,6 +3264,7 @@ public class DankersSkyblockMod for (Slot slot : invSlots) { ItemStack item = slot.getStack(); if (item == null) continue; + if (item.isItemEnchanted()) continue; if (StringUtils.stripControlCodes(item.getDisplayName()).charAt(0) == letter) { Utils.drawOnSlot(chestSize, slot.xDisplayPosition, slot.yDisplayPosition, 0xBF40FF40); } @@ -3283,7 +3284,8 @@ public class DankersSkyblockMod for (Slot slot : invSlots) { ItemStack item = slot.getStack(); if (item == null) continue; - String itemName = StringUtils.stripControlCodes(item.getDisplayName()).toUpperCase(); + if (item.isItemEnchanted()) continue; + String itemName = StringUtils.stripControlCodes(item.getDisplayName()).toUpperCase(); if (itemName.contains(colour) || (colour.equals("SILVER") && itemName.contains("LIGHT GRAY")) || (colour.equals("WHITE") && itemName.equals("WOOL"))) { Utils.drawOnSlot(chestSize, slot.xDisplayPosition, slot.yDisplayPosition, 0xBF40FF40); } @@ -3297,7 +3299,7 @@ public class DankersSkyblockMod if (itemStack == null) continue; if (itemStack.getItem() != Item.getItemFromBlock(Blocks.stained_glass_pane)) continue; if (itemStack.getItemDamage() != 5) continue; - if (itemStack.stackSize >= terminalNumberNeeded[0]) { + if (itemStack.stackSize > terminalNumberNeeded[0]) { terminalNumberNeeded[0] = itemStack.stackSize + 1; terminalNumberNeeded[1] = i; } -- cgit From c3c6730abd0cfc1619c81f68f0f9eda60cc8b903 Mon Sep 17 00:00:00 2001 From: My-Name-Is-Jeff <37018278+My-Name-Is-Jeff@users.noreply.github.com> Date: Mon, 14 Dec 2020 10:11:37 -0500 Subject: Fixed Click in Order --- src/main/java/me/Danker/DankersSkyblockMod.java | 35 ++++++++++++++++--------- 1 file changed, 22 insertions(+), 13 deletions(-) (limited to 'src/main') diff --git a/src/main/java/me/Danker/DankersSkyblockMod.java b/src/main/java/me/Danker/DankersSkyblockMod.java index 5fc820e..69f54cf 100644 --- a/src/main/java/me/Danker/DankersSkyblockMod.java +++ b/src/main/java/me/Danker/DankersSkyblockMod.java @@ -2739,6 +2739,27 @@ public class DankersSkyblockMod experimentTableSlots[i] = itemStack.copy().setStackDisplayName(itemName); } } + + if (ToggleCommand.clickInOrderToggled && chestName.equals("Click in order!")) { + if(terminalNumberNeeded[0] == 0) terminalNumberNeeded[0] = 14; + for(int i = 10; i <= 25; i++) { + if (i == 17 || i == 18) continue; + ItemStack prevStack = invSlots.get(terminalNumberNeeded[1]).getStack(); + if (prevStack == null) terminalNumberNeeded[0] = 14; + else if (prevStack.getItem() != Item.getItemFromBlock(Blocks.stained_glass_pane)) terminalNumberNeeded[0] = 14; + else if (prevStack.getItemDamage() == 5) terminalNumberNeeded[0] = 14; + + 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 (titleTimer >= 0) { @@ -3292,19 +3313,7 @@ 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() != 5) continue; - if (itemStack.stackSize > terminalNumberNeeded[0]) { - terminalNumberNeeded[0] = itemStack.stackSize + 1; - terminalNumberNeeded[1] = i; - } - } - if(terminalNumberNeeded[0] == 0) return; + if(ToggleCommand.clickInOrderToggled && displayName.equals("Click in order!")) { Slot slot = invSlots.get(terminalNumberNeeded[1]); Utils.drawOnSlot(chestSize, slot.xDisplayPosition, slot.yDisplayPosition, 0xBF40FF40); } -- cgit From 12ff5bebbe431924e5c13f8a0f88843ce9709eae Mon Sep 17 00:00:00 2001 From: My-Name-Is-Jeff <37018278+My-Name-Is-Jeff@users.noreply.github.com> Date: Mon, 14 Dec 2020 12:17:50 -0500 Subject: Add feature trace inactive terminals --- src/main/java/me/Danker/DankersSkyblockMod.java | 81 +++++++++++++++++++ src/main/java/me/Danker/commands/DHelpCommand.java | 2 +- .../java/me/Danker/commands/DankerGuiCommand.java | 1 + .../java/me/Danker/commands/ToggleCommand.java | 12 ++- src/main/java/me/Danker/gui/PuzzleSolversGui.java | 20 +++-- .../java/me/Danker/handlers/ConfigHandler.java | 2 + src/main/java/me/Danker/utils/Utils.java | 93 +++++++++++++++++++++- 7 files changed, 200 insertions(+), 11 deletions(-) (limited to 'src/main') diff --git a/src/main/java/me/Danker/DankersSkyblockMod.java b/src/main/java/me/Danker/DankersSkyblockMod.java index 69f54cf..6665604 100644 --- a/src/main/java/me/Danker/DankersSkyblockMod.java +++ b/src/main/java/me/Danker/DankersSkyblockMod.java @@ -13,9 +13,14 @@ 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.renderer.EntityRenderer; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.settings.GameSettings; import net.minecraft.client.settings.KeyBinding; import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.item.EntityArmorStand; import net.minecraft.entity.item.EntityItemFrame; import net.minecraft.entity.monster.EntityCreeper; import net.minecraft.entity.monster.EntitySpider; @@ -52,6 +57,8 @@ import net.minecraftforge.fml.client.registry.ClientRegistry; import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; +import net.minecraftforge.fml.common.ObfuscationReflectionHelper; +import net.minecraftforge.fml.common.asm.transformers.deobf.FMLDeobfuscatingRemapper; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; @@ -62,12 +69,16 @@ import net.minecraftforge.fml.common.gameevent.TickEvent; import net.minecraftforge.fml.common.gameevent.TickEvent.Phase; import net.minecraftforge.fml.common.network.FMLNetworkEvent.ClientConnectedToServerEvent; import net.minecraftforge.fml.common.versioning.DefaultArtifactVersion; +import net.minecraftforge.fml.relauncher.ReflectionHelper; import org.apache.commons.lang3.time.StopWatch; import org.lwjgl.input.Keyboard; import org.lwjgl.input.Mouse; import org.lwjgl.opengl.GL11; import java.awt.*; +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; import java.text.NumberFormat; import java.util.List; import java.util.*; @@ -2812,6 +2823,9 @@ public class DankersSkyblockMod @SubscribeEvent public void onWorldRender(RenderWorldLastEvent event) { + + Minecraft mc = Minecraft.getMinecraft(); + if (ToggleCommand.blazeToggled) { if (lowestBlaze != null) { BlockPos stringPos = new BlockPos(lowestBlaze.posX, lowestBlaze.posY + 1, lowestBlaze.posZ); @@ -2834,6 +2848,73 @@ public class DankersSkyblockMod if (ToggleCommand.ticTacToeToggled && correctTicTacToeButton != null) { Utils.draw3DBox(correctTicTacToeButton, 0x40FF40, event.partialTicks); } + + if(ToggleCommand.traceInactiveTerminalsToggled && Utils.inDungeons && ScoreboardHandler.getSidebarLines().stream().anyMatch(l->ScoreboardHandler.cleanSB(l).contains("The Catacombs (F7)"))) { + for (Entity e : mc.theWorld.getLoadedEntityList()) { + if (e instanceof EntityArmorStand) { + EntityArmorStand entity = (EntityArmorStand) e; + if(!e.hasCustomName()) continue; + if(!e.getCustomNameTag().contains("Inactive")) continue; + + float distance = mc.thePlayer.getDistanceToEntity(entity); + + float[] fractions = new float[]{0.0F, 0.5F, 1.0F}; + Color[] colors = new Color[]{Color.RED, Color.YELLOW, Color.GREEN}; + float progress = distance * 1.25F * 0.01F; + + Color color = Utils.blendColors(fractions, colors, progress).brighter(); + float width = 1.0f; + float partialTicks = event.partialTicks; + + float r = ((float) 1 / 255) * color.getRed(); + float g = ((float) 1 / 255) * color.getGreen(); + float b = ((float) 1 / 255) * color.getBlue(); + GL11.glPushMatrix(); + + GL11.glLoadIdentity(); + + Method orientCamera = ReflectionHelper.findMethod(EntityRenderer.class, mc.entityRenderer, new String[]{"orientCamera"}, float.class); + try { + //mc.entityRenderer.orientCamera(partialTicks); + orientCamera.invoke(mc.entityRenderer, partialTicks); + } catch (IllegalAccessException illegalAccessException) { + illegalAccessException.printStackTrace(); + } catch (InvocationTargetException invocationTargetException) { + invocationTargetException.printStackTrace(); + } + + GL11.glDisable(2929); + GL11.glDisable(3553); + GL11.glEnable(3042); + GL11.glBlendFunc(770, 771); + + GL11.glEnable(GL11.GL_LINE_SMOOTH); + + double x = Utils.interpolate(entity.posX, entity.lastTickPosX, partialTicks) - mc.getRenderManager().viewerPosX; + double y = Utils.interpolate(entity.posY + entity.getEyeHeight(), entity.lastTickPosY + entity.getEyeHeight(), partialTicks) - mc.getRenderManager().viewerPosY; + double z = Utils.interpolate(entity.posZ, entity.lastTickPosZ, partialTicks) - mc.getRenderManager().viewerPosZ; + + GL11.glLineWidth(width); + + GL11.glBegin(GL11.GL_LINE_STRIP); + { + GL11.glColor3d(r, g, b); + GL11.glVertex3d(x, y, z); + GL11.glVertex3d(0.0, mc.thePlayer.getEyeHeight(), 0.0); + GL11.glEnd(); + GL11.glDisable(GL11.GL_LINE_SMOOTH); + + GL11.glDisable(3042); + GL11.glEnable(3553); + GL11.glEnable(2929); + + GL11.glPopMatrix(); + } + + } + } + } + } @SubscribeEvent diff --git a/src/main/java/me/Danker/commands/DHelpCommand.java b/src/main/java/me/Danker/commands/DHelpCommand.java index b2f6824..8e998f2 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 " + EnumChatFormatting.AQUA + " - Toggles features. /toggle list returns values of every toggle.\n" + + EnumChatFormatting.GOLD + " /toggle " + EnumChatFormatting.AQUA + " - Toggles features. /toggle list returns values of every toggle.\n" + EnumChatFormatting.GOLD + " /setkey " + 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 [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/DankerGuiCommand.java b/src/main/java/me/Danker/commands/DankerGuiCommand.java index 7c9c2f0..a003762 100644 --- a/src/main/java/me/Danker/commands/DankerGuiCommand.java +++ b/src/main/java/me/Danker/commands/DankerGuiCommand.java @@ -65,6 +65,7 @@ public class DankerGuiCommand extends CommandBase { debug.append("[creeperpuzzle][").append(ToggleCommand.creeperToggled).append("]\n"); debug.append("[waterpuzzle][").append(ToggleCommand.waterToggled).append("]\n"); debug.append("[tictactoepuzzle][").append(ToggleCommand.ticTacToeToggled).append("]\n"); + debug.append("[traceinactiveterminals][").append(ToggleCommand.traceInactiveTerminalsToggled).append("]\n"); debug.append("[startswithterminal][").append(ToggleCommand.startsWithToggled).append("]\n"); debug.append("[selectallterminal][").append(ToggleCommand.selectAllToggled).append("]\n"); debug.append("[clickinorderterminal][").append(ToggleCommand.clickInOrderToggled).append("]\n"); diff --git a/src/main/java/me/Danker/commands/ToggleCommand.java b/src/main/java/me/Danker/commands/ToggleCommand.java index 3b1c04d..d9d7024 100644 --- a/src/main/java/me/Danker/commands/ToggleCommand.java +++ b/src/main/java/me/Danker/commands/ToggleCommand.java @@ -48,6 +48,7 @@ public class ToggleCommand extends CommandBase implements ICommand { public static boolean waterToggled; public static boolean ticTacToeToggled; // Terminal Helpers + public static boolean traceInactiveTerminalsToggled; public static boolean startsWithToggled; public static boolean selectAllToggled; public static boolean clickInOrderToggled; @@ -70,7 +71,7 @@ public class ToggleCommand extends CommandBase implements ICommand { "aotd/lividdagger/sceptremessages/petcolors/dungeontimer/golemalerts/expertiselore/skill50display/" + "outlinetext/midasstaffmessages/implosionmessages/healmessages/caketimer/lowhealthnotify/" + "lividsolver/stopsalvagestarred/notifyslayerslain/threemanpuzzle/oruopuzzle/blazepuzzle/creeperpuzzle/waterpuzzle/tictactoepuzzle/" + - "watchermessage/startswithterminal/selectallterminal/clickinorderterminal/blockwrongterminalclicks/itemframeonsealanterns/ultrasequencer/chronomatron/superpairs/hidetooltipsinaddons/pickblock/list>"; + "watchermessage/traceinactiveterminals/startswithterminal/selectallterminal/clickinorderterminal/blockwrongterminalclicks/itemframeonsealanterns/ultrasequencer/chronomatron/superpairs/hidetooltipsinaddons/pickblock/list>"; } @Override @@ -87,7 +88,7 @@ public class ToggleCommand extends CommandBase implements ICommand { "expertiselore", "skill50display", "outlinetext", "midasstaffmessages", "implosionmessages", "healmessages", "caketimer", "lowhealthnotify", "lividsolver", "stopsalvagestarred", "notifyslayerslain", "threemanpuzzle", "oruopuzzle", "blazepuzzle", - "creeperpuzzle", "waterpuzzle", "tictactoepuzzle", "watchermessage", "startswithterminal", + "creeperpuzzle", "waterpuzzle", "tictactoepuzzle", "watchermessage", "traceinactiveterminals", "startswithterminal", "selectallterminal", "clickinorderterminal", "blockwrongterminalclicks", "itemframeonsealanterns", "ultrasequencer", "chronomatron", "superpairs", "hidetooltipsinaddons", "pickblock", "list"); } @@ -264,7 +265,12 @@ public class ToggleCommand extends CommandBase implements ICommand { watcherReadyToggled = !watcherReadyToggled; ConfigHandler.writeBooleanConfig("toggles", "WatcherReadyMessage", watcherReadyToggled); player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Display Watcher ready message has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + watcherReadyToggled + DankersSkyblockMod.MAIN_COLOUR + ".")); - break; + break; + case "traceinactiveterminals": + traceInactiveTerminalsToggled = !traceInactiveTerminalsToggled; + ConfigHandler.writeBooleanConfig("toggles", "TraceInactiveTerminals", traceInactiveTerminalsToggled); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Trace inactive terminals has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + traceInactiveTerminalsToggled + DankersSkyblockMod.MAIN_COLOUR + ".")); + break; case "startswithterminal": startsWithToggled = !startsWithToggled; ConfigHandler.writeBooleanConfig("toggles", "StartsWithTerminal", startsWithToggled); diff --git a/src/main/java/me/Danker/gui/PuzzleSolversGui.java b/src/main/java/me/Danker/gui/PuzzleSolversGui.java index 17eb433..693e6c4 100644 --- a/src/main/java/me/Danker/gui/PuzzleSolversGui.java +++ b/src/main/java/me/Danker/gui/PuzzleSolversGui.java @@ -22,6 +22,7 @@ public class PuzzleSolversGui extends GuiScreen { private GuiButton creeper; private GuiButton water; private GuiButton ticTacToe; + private GuiButton traceInactive; private GuiButton startsWith; private GuiButton selectAll; private GuiButton clickOrder; @@ -56,12 +57,14 @@ public class PuzzleSolversGui extends GuiScreen { creeper = new GuiButton(0, width / 2 - 100, (int) (height * 0.4), "Creeper Solver: " + Utils.getColouredBoolean(ToggleCommand.creeperToggled)); water = new GuiButton(0, width / 2 - 100, (int) (height * 0.5), "Water Solver: " + Utils.getColouredBoolean(ToggleCommand.waterToggled)); ticTacToe = new GuiButton(0, width / 2 - 100, (int) (height * 0.6), "Tic Tac Toe Solver: " + Utils.getColouredBoolean(ToggleCommand.ticTacToeToggled)); - startsWith = new GuiButton(0, width / 2 - 100, (int) (height * 0.7), "Starts With Letter Terminal Solver: " + Utils.getColouredBoolean(ToggleCommand.startsWithToggled)); + traceInactive = new GuiButton(0, width / 2 - 100, (int) (height * 0.7), "Trace Inactive Terminals: " + Utils.getColouredBoolean(ToggleCommand.traceInactiveTerminalsToggled)); + // Page 2 - selectAll = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Select All Color Terminal Solver: " + Utils.getColouredBoolean(ToggleCommand.selectAllToggled)); - clickOrder = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Click in Order Terminal Helper: " + 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)); + startsWith = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Starts With Letter Terminal Solver: " + Utils.getColouredBoolean(ToggleCommand.startsWithToggled)); + selectAll = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Select All Color Terminal Solver: " + Utils.getColouredBoolean(ToggleCommand.selectAllToggled)); + clickOrder = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "Click in Order Terminal Helper: " + Utils.getColouredBoolean(ToggleCommand.clickInOrderToggled)); + blockClicks = new GuiButton(0, width / 2 - 100, (int) (height * 0.4), "Block Wrong Clicks on Terminals: " + Utils.getColouredBoolean(ToggleCommand.blockWrongTerminalClicksToggled)); + itemFrameOnSeaLanterns = new GuiButton(0, width / 2 - 100, (int) (height * 0.5), "Ignore Arrows On Sea Lanterns: " + Utils.getColouredBoolean(ToggleCommand.itemFrameOnSeaLanternsToggled)); switch (page) { case 1: @@ -71,10 +74,11 @@ public class PuzzleSolversGui extends GuiScreen { this.buttonList.add(creeper); this.buttonList.add(water); this.buttonList.add(ticTacToe); - this.buttonList.add(startsWith); + this.buttonList.add(traceInactive); this.buttonList.add(nextPage); break; case 2: + this.buttonList.add(startsWith); this.buttonList.add(selectAll); this.buttonList.add(clickOrder); this.buttonList.add(blockClicks); @@ -123,6 +127,10 @@ public class PuzzleSolversGui extends GuiScreen { ToggleCommand.ticTacToeToggled = !ToggleCommand.ticTacToeToggled; ConfigHandler.writeBooleanConfig("toggles", "TicTacToePuzzle", ToggleCommand.ticTacToeToggled); ticTacToe.displayString = "Tic Tac Toe Solver: " + Utils.getColouredBoolean(ToggleCommand.ticTacToeToggled); + } else if (button == traceInactive) { + ToggleCommand.traceInactiveTerminalsToggled = !ToggleCommand.traceInactiveTerminalsToggled; + ConfigHandler.writeBooleanConfig("toggles", "TraceInactiveTerminals", ToggleCommand.traceInactiveTerminalsToggled); + traceInactive.displayString = "Trace Inactive Terminals: " + Utils.getColouredBoolean(ToggleCommand.traceInactiveTerminalsToggled); } else if (button == startsWith) { ToggleCommand.startsWithToggled = !ToggleCommand.startsWithToggled; ConfigHandler.writeBooleanConfig("toggles", "StartsWithTerminal", ToggleCommand.startsWithToggled); diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java index 531d631..aae3f59 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", "CreeperPuzzle")) writeBooleanConfig("toggles", "CreeperPuzzle", false); if (!hasKey("toggles", "WaterPuzzle")) writeBooleanConfig("toggles", "WaterPuzzle", false); if (!hasKey("toggles", "TicTacToePuzzle")) writeBooleanConfig("toggles", "TicTacToePuzzle", false); + if (!hasKey("toggles", "TraceInactiveTerminals")) writeBooleanConfig("toggles", "TraceInactiveTerminals", 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); @@ -469,6 +470,7 @@ public class ConfigHandler { ToggleCommand.creeperToggled = getBoolean("toggles", "CreeperPuzzle"); ToggleCommand.waterToggled = getBoolean("toggles", "WaterPuzzle"); ToggleCommand.ticTacToeToggled = getBoolean("toggles", "TicTacToePuzzle"); + ToggleCommand.traceInactiveTerminalsToggled = getBoolean("toggles", "TraceInactiveTerminals"); ToggleCommand.startsWithToggled = getBoolean("toggles", "StartsWithTerminal"); ToggleCommand.selectAllToggled = getBoolean("toggles", "SelectAllTerminal"); ToggleCommand.clickInOrderToggled = getBoolean("toggles", "ClickInOrderTerminal"); diff --git a/src/main/java/me/Danker/utils/Utils.java b/src/main/java/me/Danker/utils/Utils.java index e4f7873..6c1fadb 100644 --- a/src/main/java/me/Danker/utils/Utils.java +++ b/src/main/java/me/Danker/utils/Utils.java @@ -25,6 +25,7 @@ import net.minecraft.util.*; import org.lwjgl.opengl.GL11; import java.awt.*; +import java.text.NumberFormat; import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -386,6 +387,96 @@ public class Utils { RenderHelper.disableStandardItemLighting(); GlStateManager.disableRescaleNormal(); } + + public static double interpolate(double current, double old, double scale) { + return old + (current - old) * scale; + } + + // Yoink! https://stackoverflow.com/a/51780112 + public static Color blendColors(float[] fractions, Color[] colors, float progress) { + Color color; + if (fractions != null) { + if (colors != null) { + if (fractions.length == colors.length) { + int[] indices = getFractionIndices(fractions, progress); + if (indices[0] >= 0 && indices[0] < fractions.length && indices[1] >= 0 && indices[1] < fractions.length) { + float[] range = new float[]{fractions[indices[0]], fractions[indices[1]]}; + Color[] colorRange = new Color[]{colors[indices[0]], colors[indices[1]]}; + float max = range[1] - range[0]; + float value = progress - range[0]; + float weight = value / max; + color = blend(colorRange[0], colorRange[1], 1.0F - weight); + return color; + } else { + return colors[0]; + } + } else { + throw new IllegalArgumentException("Fractions and colours must have equal number of elements"); + } + } else { + throw new IllegalArgumentException("Colors can't be null"); + } + } else { + throw new IllegalArgumentException("Fractions can't be null"); + } + } + + public static int[] getFractionIndices(float[] fractions, float progress) { + int[] range = new int[2]; + + int startPoint; + for (startPoint = 0; startPoint < fractions.length && fractions[startPoint] <= progress; ++startPoint) { + } + + if (startPoint >= fractions.length) { + startPoint = fractions.length - 1; + } + + range[0] = startPoint - 1; + range[1] = startPoint; + return range; + } + + public static Color blend(Color color1, Color color2, double ratio) { + float r = (float) ratio; + float ir = 1.0F - r; + float[] rgb1 = new float[3]; + float[] rgb2 = new float[3]; + color1.getColorComponents(rgb1); + color2.getColorComponents(rgb2); + float red = rgb1[0] * r + rgb2[0] * ir; + float green = rgb1[1] * r + rgb2[1] * ir; + float blue = rgb1[2] * r + rgb2[2] * ir; + if (red < 0.0F) { + red = 0.0F; + } else if (red > 255.0F) { + red = 255.0F; + } + + if (green < 0.0F) { + green = 0.0F; + } else if (green > 255.0F) { + green = 255.0F; + } + + if (blue < 0.0F) { + blue = 0.0F; + } else if (blue > 255.0F) { + blue = 255.0F; + } + + Color color = null; + + try { + color = new Color(red, green, blue); + } catch (IllegalArgumentException var14) { + NumberFormat nf = NumberFormat.getNumberInstance(); + System.out.println(nf.format(red) + "; " + nf.format(green) + "; " + nf.format(blue)); + var14.printStackTrace(); + } + + return color; + } public static BlockPos getFirstBlockPosAfterVectors(Minecraft mc, Vec3 pos1, Vec3 pos2, int strength, int distance) { double x = pos2.xCoord - pos1.xCoord; @@ -441,5 +532,5 @@ public class Utils { return null; } } - + } -- cgit From cdaeca21f7d4382c3f8941b35b1836872967df9a Mon Sep 17 00:00:00 2001 From: My-Name-Is-Jeff <37018278+My-Name-Is-Jeff@users.noreply.github.com> Date: Mon, 14 Dec 2020 12:53:28 -0500 Subject: Remove some random import --- src/main/java/me/Danker/commands/ScaleCommand.java | 1 - 1 file changed, 1 deletion(-) (limited to 'src/main') diff --git a/src/main/java/me/Danker/commands/ScaleCommand.java b/src/main/java/me/Danker/commands/ScaleCommand.java index 85d0d5c..1c0843d 100644 --- a/src/main/java/me/Danker/commands/ScaleCommand.java +++ b/src/main/java/me/Danker/commands/ScaleCommand.java @@ -8,7 +8,6 @@ import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.BlockPos; import net.minecraft.util.ChatComponentText; -import sun.security.krb5.Config; import java.util.List; -- cgit From 3deb21c90e4d66b669c123d170c36d1a93d8243c Mon Sep 17 00:00:00 2001 From: My-Name-Is-Jeff <37018278+My-Name-Is-Jeff@users.noreply.github.com> Date: Mon, 14 Dec 2020 13:25:26 -0500 Subject: Revert "Add feature trace inactive terminals" This reverts commit 12ff5bebbe431924e5c13f8a0f88843ce9709eae. --- src/main/java/me/Danker/DankersSkyblockMod.java | 81 ------------------- src/main/java/me/Danker/commands/DHelpCommand.java | 2 +- .../java/me/Danker/commands/DankerGuiCommand.java | 1 - .../java/me/Danker/commands/ToggleCommand.java | 12 +-- src/main/java/me/Danker/gui/PuzzleSolversGui.java | 20 ++--- .../java/me/Danker/handlers/ConfigHandler.java | 2 - src/main/java/me/Danker/utils/Utils.java | 93 +--------------------- 7 files changed, 11 insertions(+), 200 deletions(-) (limited to 'src/main') diff --git a/src/main/java/me/Danker/DankersSkyblockMod.java b/src/main/java/me/Danker/DankersSkyblockMod.java index 6665604..69f54cf 100644 --- a/src/main/java/me/Danker/DankersSkyblockMod.java +++ b/src/main/java/me/Danker/DankersSkyblockMod.java @@ -13,14 +13,9 @@ 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.renderer.EntityRenderer; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.settings.GameSettings; import net.minecraft.client.settings.KeyBinding; import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.item.EntityArmorStand; import net.minecraft.entity.item.EntityItemFrame; import net.minecraft.entity.monster.EntityCreeper; import net.minecraft.entity.monster.EntitySpider; @@ -57,8 +52,6 @@ import net.minecraftforge.fml.client.registry.ClientRegistry; import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; -import net.minecraftforge.fml.common.ObfuscationReflectionHelper; -import net.minecraftforge.fml.common.asm.transformers.deobf.FMLDeobfuscatingRemapper; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; @@ -69,16 +62,12 @@ import net.minecraftforge.fml.common.gameevent.TickEvent; import net.minecraftforge.fml.common.gameevent.TickEvent.Phase; import net.minecraftforge.fml.common.network.FMLNetworkEvent.ClientConnectedToServerEvent; import net.minecraftforge.fml.common.versioning.DefaultArtifactVersion; -import net.minecraftforge.fml.relauncher.ReflectionHelper; import org.apache.commons.lang3.time.StopWatch; import org.lwjgl.input.Keyboard; import org.lwjgl.input.Mouse; import org.lwjgl.opengl.GL11; import java.awt.*; -import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; import java.text.NumberFormat; import java.util.List; import java.util.*; @@ -2823,9 +2812,6 @@ public class DankersSkyblockMod @SubscribeEvent public void onWorldRender(RenderWorldLastEvent event) { - - Minecraft mc = Minecraft.getMinecraft(); - if (ToggleCommand.blazeToggled) { if (lowestBlaze != null) { BlockPos stringPos = new BlockPos(lowestBlaze.posX, lowestBlaze.posY + 1, lowestBlaze.posZ); @@ -2848,73 +2834,6 @@ public class DankersSkyblockMod if (ToggleCommand.ticTacToeToggled && correctTicTacToeButton != null) { Utils.draw3DBox(correctTicTacToeButton, 0x40FF40, event.partialTicks); } - - if(ToggleCommand.traceInactiveTerminalsToggled && Utils.inDungeons && ScoreboardHandler.getSidebarLines().stream().anyMatch(l->ScoreboardHandler.cleanSB(l).contains("The Catacombs (F7)"))) { - for (Entity e : mc.theWorld.getLoadedEntityList()) { - if (e instanceof EntityArmorStand) { - EntityArmorStand entity = (EntityArmorStand) e; - if(!e.hasCustomName()) continue; - if(!e.getCustomNameTag().contains("Inactive")) continue; - - float distance = mc.thePlayer.getDistanceToEntity(entity); - - float[] fractions = new float[]{0.0F, 0.5F, 1.0F}; - Color[] colors = new Color[]{Color.RED, Color.YELLOW, Color.GREEN}; - float progress = distance * 1.25F * 0.01F; - - Color color = Utils.blendColors(fractions, colors, progress).brighter(); - float width = 1.0f; - float partialTicks = event.partialTicks; - - float r = ((float) 1 / 255) * color.getRed(); - float g = ((float) 1 / 255) * color.getGreen(); - float b = ((float) 1 / 255) * color.getBlue(); - GL11.glPushMatrix(); - - GL11.glLoadIdentity(); - - Method orientCamera = ReflectionHelper.findMethod(EntityRenderer.class, mc.entityRenderer, new String[]{"orientCamera"}, float.class); - try { - //mc.entityRenderer.orientCamera(partialTicks); - orientCamera.invoke(mc.entityRenderer, partialTicks); - } catch (IllegalAccessException illegalAccessException) { - illegalAccessException.printStackTrace(); - } catch (InvocationTargetException invocationTargetException) { - invocationTargetException.printStackTrace(); - } - - GL11.glDisable(2929); - GL11.glDisable(3553); - GL11.glEnable(3042); - GL11.glBlendFunc(770, 771); - - GL11.glEnable(GL11.GL_LINE_SMOOTH); - - double x = Utils.interpolate(entity.posX, entity.lastTickPosX, partialTicks) - mc.getRenderManager().viewerPosX; - double y = Utils.interpolate(entity.posY + entity.getEyeHeight(), entity.lastTickPosY + entity.getEyeHeight(), partialTicks) - mc.getRenderManager().viewerPosY; - double z = Utils.interpolate(entity.posZ, entity.lastTickPosZ, partialTicks) - mc.getRenderManager().viewerPosZ; - - GL11.glLineWidth(width); - - GL11.glBegin(GL11.GL_LINE_STRIP); - { - GL11.glColor3d(r, g, b); - GL11.glVertex3d(x, y, z); - GL11.glVertex3d(0.0, mc.thePlayer.getEyeHeight(), 0.0); - GL11.glEnd(); - GL11.glDisable(GL11.GL_LINE_SMOOTH); - - GL11.glDisable(3042); - GL11.glEnable(3553); - GL11.glEnable(2929); - - GL11.glPopMatrix(); - } - - } - } - } - } @SubscribeEvent diff --git a/src/main/java/me/Danker/commands/DHelpCommand.java b/src/main/java/me/Danker/commands/DHelpCommand.java index 8e998f2..b2f6824 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 " + EnumChatFormatting.AQUA + " - Toggles features. /toggle list returns values of every toggle.\n" + + EnumChatFormatting.GOLD + " /toggle " + EnumChatFormatting.AQUA + " - Toggles features. /toggle list returns values of every toggle.\n" + EnumChatFormatting.GOLD + " /setkey " + 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 [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/DankerGuiCommand.java b/src/main/java/me/Danker/commands/DankerGuiCommand.java index a003762..7c9c2f0 100644 --- a/src/main/java/me/Danker/commands/DankerGuiCommand.java +++ b/src/main/java/me/Danker/commands/DankerGuiCommand.java @@ -65,7 +65,6 @@ public class DankerGuiCommand extends CommandBase { debug.append("[creeperpuzzle][").append(ToggleCommand.creeperToggled).append("]\n"); debug.append("[waterpuzzle][").append(ToggleCommand.waterToggled).append("]\n"); debug.append("[tictactoepuzzle][").append(ToggleCommand.ticTacToeToggled).append("]\n"); - debug.append("[traceinactiveterminals][").append(ToggleCommand.traceInactiveTerminalsToggled).append("]\n"); debug.append("[startswithterminal][").append(ToggleCommand.startsWithToggled).append("]\n"); debug.append("[selectallterminal][").append(ToggleCommand.selectAllToggled).append("]\n"); debug.append("[clickinorderterminal][").append(ToggleCommand.clickInOrderToggled).append("]\n"); diff --git a/src/main/java/me/Danker/commands/ToggleCommand.java b/src/main/java/me/Danker/commands/ToggleCommand.java index d9d7024..3b1c04d 100644 --- a/src/main/java/me/Danker/commands/ToggleCommand.java +++ b/src/main/java/me/Danker/commands/ToggleCommand.java @@ -48,7 +48,6 @@ public class ToggleCommand extends CommandBase implements ICommand { public static boolean waterToggled; public static boolean ticTacToeToggled; // Terminal Helpers - public static boolean traceInactiveTerminalsToggled; public static boolean startsWithToggled; public static boolean selectAllToggled; public static boolean clickInOrderToggled; @@ -71,7 +70,7 @@ public class ToggleCommand extends CommandBase implements ICommand { "aotd/lividdagger/sceptremessages/petcolors/dungeontimer/golemalerts/expertiselore/skill50display/" + "outlinetext/midasstaffmessages/implosionmessages/healmessages/caketimer/lowhealthnotify/" + "lividsolver/stopsalvagestarred/notifyslayerslain/threemanpuzzle/oruopuzzle/blazepuzzle/creeperpuzzle/waterpuzzle/tictactoepuzzle/" + - "watchermessage/traceinactiveterminals/startswithterminal/selectallterminal/clickinorderterminal/blockwrongterminalclicks/itemframeonsealanterns/ultrasequencer/chronomatron/superpairs/hidetooltipsinaddons/pickblock/list>"; + "watchermessage/startswithterminal/selectallterminal/clickinorderterminal/blockwrongterminalclicks/itemframeonsealanterns/ultrasequencer/chronomatron/superpairs/hidetooltipsinaddons/pickblock/list>"; } @Override @@ -88,7 +87,7 @@ public class ToggleCommand extends CommandBase implements ICommand { "expertiselore", "skill50display", "outlinetext", "midasstaffmessages", "implosionmessages", "healmessages", "caketimer", "lowhealthnotify", "lividsolver", "stopsalvagestarred", "notifyslayerslain", "threemanpuzzle", "oruopuzzle", "blazepuzzle", - "creeperpuzzle", "waterpuzzle", "tictactoepuzzle", "watchermessage", "traceinactiveterminals", "startswithterminal", + "creeperpuzzle", "waterpuzzle", "tictactoepuzzle", "watchermessage", "startswithterminal", "selectallterminal", "clickinorderterminal", "blockwrongterminalclicks", "itemframeonsealanterns", "ultrasequencer", "chronomatron", "superpairs", "hidetooltipsinaddons", "pickblock", "list"); } @@ -265,12 +264,7 @@ public class ToggleCommand extends CommandBase implements ICommand { watcherReadyToggled = !watcherReadyToggled; ConfigHandler.writeBooleanConfig("toggles", "WatcherReadyMessage", watcherReadyToggled); player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Display Watcher ready message has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + watcherReadyToggled + DankersSkyblockMod.MAIN_COLOUR + ".")); - break; - case "traceinactiveterminals": - traceInactiveTerminalsToggled = !traceInactiveTerminalsToggled; - ConfigHandler.writeBooleanConfig("toggles", "TraceInactiveTerminals", traceInactiveTerminalsToggled); - player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Trace inactive terminals has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + traceInactiveTerminalsToggled + DankersSkyblockMod.MAIN_COLOUR + ".")); - break; + break; case "startswithterminal": startsWithToggled = !startsWithToggled; ConfigHandler.writeBooleanConfig("toggles", "StartsWithTerminal", startsWithToggled); diff --git a/src/main/java/me/Danker/gui/PuzzleSolversGui.java b/src/main/java/me/Danker/gui/PuzzleSolversGui.java index 693e6c4..17eb433 100644 --- a/src/main/java/me/Danker/gui/PuzzleSolversGui.java +++ b/src/main/java/me/Danker/gui/PuzzleSolversGui.java @@ -22,7 +22,6 @@ public class PuzzleSolversGui extends GuiScreen { private GuiButton creeper; private GuiButton water; private GuiButton ticTacToe; - private GuiButton traceInactive; private GuiButton startsWith; private GuiButton selectAll; private GuiButton clickOrder; @@ -57,14 +56,12 @@ public class PuzzleSolversGui extends GuiScreen { creeper = new GuiButton(0, width / 2 - 100, (int) (height * 0.4), "Creeper Solver: " + Utils.getColouredBoolean(ToggleCommand.creeperToggled)); water = new GuiButton(0, width / 2 - 100, (int) (height * 0.5), "Water Solver: " + Utils.getColouredBoolean(ToggleCommand.waterToggled)); ticTacToe = new GuiButton(0, width / 2 - 100, (int) (height * 0.6), "Tic Tac Toe Solver: " + Utils.getColouredBoolean(ToggleCommand.ticTacToeToggled)); - traceInactive = new GuiButton(0, width / 2 - 100, (int) (height * 0.7), "Trace Inactive Terminals: " + Utils.getColouredBoolean(ToggleCommand.traceInactiveTerminalsToggled)); - + startsWith = new GuiButton(0, width / 2 - 100, (int) (height * 0.7), "Starts With Letter Terminal Solver: " + Utils.getColouredBoolean(ToggleCommand.startsWithToggled)); // Page 2 - startsWith = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Starts With Letter Terminal Solver: " + Utils.getColouredBoolean(ToggleCommand.startsWithToggled)); - selectAll = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Select All Color Terminal Solver: " + Utils.getColouredBoolean(ToggleCommand.selectAllToggled)); - clickOrder = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "Click in Order Terminal Helper: " + Utils.getColouredBoolean(ToggleCommand.clickInOrderToggled)); - blockClicks = new GuiButton(0, width / 2 - 100, (int) (height * 0.4), "Block Wrong Clicks on Terminals: " + Utils.getColouredBoolean(ToggleCommand.blockWrongTerminalClicksToggled)); - itemFrameOnSeaLanterns = new GuiButton(0, width / 2 - 100, (int) (height * 0.5), "Ignore Arrows On Sea Lanterns: " + Utils.getColouredBoolean(ToggleCommand.itemFrameOnSeaLanternsToggled)); + selectAll = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Select All Color Terminal Solver: " + Utils.getColouredBoolean(ToggleCommand.selectAllToggled)); + clickOrder = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Click in Order Terminal Helper: " + 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,11 +71,10 @@ public class PuzzleSolversGui extends GuiScreen { this.buttonList.add(creeper); this.buttonList.add(water); this.buttonList.add(ticTacToe); - this.buttonList.add(traceInactive); + this.buttonList.add(startsWith); this.buttonList.add(nextPage); break; case 2: - this.buttonList.add(startsWith); this.buttonList.add(selectAll); this.buttonList.add(clickOrder); this.buttonList.add(blockClicks); @@ -127,10 +123,6 @@ public class PuzzleSolversGui extends GuiScreen { ToggleCommand.ticTacToeToggled = !ToggleCommand.ticTacToeToggled; ConfigHandler.writeBooleanConfig("toggles", "TicTacToePuzzle", ToggleCommand.ticTacToeToggled); ticTacToe.displayString = "Tic Tac Toe Solver: " + Utils.getColouredBoolean(ToggleCommand.ticTacToeToggled); - } else if (button == traceInactive) { - ToggleCommand.traceInactiveTerminalsToggled = !ToggleCommand.traceInactiveTerminalsToggled; - ConfigHandler.writeBooleanConfig("toggles", "TraceInactiveTerminals", ToggleCommand.traceInactiveTerminalsToggled); - traceInactive.displayString = "Trace Inactive Terminals: " + Utils.getColouredBoolean(ToggleCommand.traceInactiveTerminalsToggled); } else if (button == startsWith) { ToggleCommand.startsWithToggled = !ToggleCommand.startsWithToggled; ConfigHandler.writeBooleanConfig("toggles", "StartsWithTerminal", ToggleCommand.startsWithToggled); diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java index aae3f59..531d631 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -202,7 +202,6 @@ public class ConfigHandler { if (!hasKey("toggles", "CreeperPuzzle")) writeBooleanConfig("toggles", "CreeperPuzzle", false); if (!hasKey("toggles", "WaterPuzzle")) writeBooleanConfig("toggles", "WaterPuzzle", false); if (!hasKey("toggles", "TicTacToePuzzle")) writeBooleanConfig("toggles", "TicTacToePuzzle", false); - if (!hasKey("toggles", "TraceInactiveTerminals")) writeBooleanConfig("toggles", "TraceInactiveTerminals", 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); @@ -470,7 +469,6 @@ public class ConfigHandler { ToggleCommand.creeperToggled = getBoolean("toggles", "CreeperPuzzle"); ToggleCommand.waterToggled = getBoolean("toggles", "WaterPuzzle"); ToggleCommand.ticTacToeToggled = getBoolean("toggles", "TicTacToePuzzle"); - ToggleCommand.traceInactiveTerminalsToggled = getBoolean("toggles", "TraceInactiveTerminals"); ToggleCommand.startsWithToggled = getBoolean("toggles", "StartsWithTerminal"); ToggleCommand.selectAllToggled = getBoolean("toggles", "SelectAllTerminal"); ToggleCommand.clickInOrderToggled = getBoolean("toggles", "ClickInOrderTerminal"); diff --git a/src/main/java/me/Danker/utils/Utils.java b/src/main/java/me/Danker/utils/Utils.java index 6c1fadb..e4f7873 100644 --- a/src/main/java/me/Danker/utils/Utils.java +++ b/src/main/java/me/Danker/utils/Utils.java @@ -25,7 +25,6 @@ import net.minecraft.util.*; import org.lwjgl.opengl.GL11; import java.awt.*; -import java.text.NumberFormat; import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -387,96 +386,6 @@ public class Utils { RenderHelper.disableStandardItemLighting(); GlStateManager.disableRescaleNormal(); } - - public static double interpolate(double current, double old, double scale) { - return old + (current - old) * scale; - } - - // Yoink! https://stackoverflow.com/a/51780112 - public static Color blendColors(float[] fractions, Color[] colors, float progress) { - Color color; - if (fractions != null) { - if (colors != null) { - if (fractions.length == colors.length) { - int[] indices = getFractionIndices(fractions, progress); - if (indices[0] >= 0 && indices[0] < fractions.length && indices[1] >= 0 && indices[1] < fractions.length) { - float[] range = new float[]{fractions[indices[0]], fractions[indices[1]]}; - Color[] colorRange = new Color[]{colors[indices[0]], colors[indices[1]]}; - float max = range[1] - range[0]; - float value = progress - range[0]; - float weight = value / max; - color = blend(colorRange[0], colorRange[1], 1.0F - weight); - return color; - } else { - return colors[0]; - } - } else { - throw new IllegalArgumentException("Fractions and colours must have equal number of elements"); - } - } else { - throw new IllegalArgumentException("Colors can't be null"); - } - } else { - throw new IllegalArgumentException("Fractions can't be null"); - } - } - - public static int[] getFractionIndices(float[] fractions, float progress) { - int[] range = new int[2]; - - int startPoint; - for (startPoint = 0; startPoint < fractions.length && fractions[startPoint] <= progress; ++startPoint) { - } - - if (startPoint >= fractions.length) { - startPoint = fractions.length - 1; - } - - range[0] = startPoint - 1; - range[1] = startPoint; - return range; - } - - public static Color blend(Color color1, Color color2, double ratio) { - float r = (float) ratio; - float ir = 1.0F - r; - float[] rgb1 = new float[3]; - float[] rgb2 = new float[3]; - color1.getColorComponents(rgb1); - color2.getColorComponents(rgb2); - float red = rgb1[0] * r + rgb2[0] * ir; - float green = rgb1[1] * r + rgb2[1] * ir; - float blue = rgb1[2] * r + rgb2[2] * ir; - if (red < 0.0F) { - red = 0.0F; - } else if (red > 255.0F) { - red = 255.0F; - } - - if (green < 0.0F) { - green = 0.0F; - } else if (green > 255.0F) { - green = 255.0F; - } - - if (blue < 0.0F) { - blue = 0.0F; - } else if (blue > 255.0F) { - blue = 255.0F; - } - - Color color = null; - - try { - color = new Color(red, green, blue); - } catch (IllegalArgumentException var14) { - NumberFormat nf = NumberFormat.getNumberInstance(); - System.out.println(nf.format(red) + "; " + nf.format(green) + "; " + nf.format(blue)); - var14.printStackTrace(); - } - - return color; - } public static BlockPos getFirstBlockPosAfterVectors(Minecraft mc, Vec3 pos1, Vec3 pos2, int strength, int distance) { double x = pos2.xCoord - pos1.xCoord; @@ -532,5 +441,5 @@ public class Utils { return null; } } - + } -- cgit From 120264a46d06a2dcc9e4f75e39c2411f98c24427 Mon Sep 17 00:00:00 2001 From: My-Name-Is-Jeff <37018278+My-Name-Is-Jeff@users.noreply.github.com> Date: Mon, 14 Dec 2020 19:15:53 -0500 Subject: Fixed click in order --- src/main/java/me/Danker/DankersSkyblockMod.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/main') diff --git a/src/main/java/me/Danker/DankersSkyblockMod.java b/src/main/java/me/Danker/DankersSkyblockMod.java index 69f54cf..b55131e 100644 --- a/src/main/java/me/Danker/DankersSkyblockMod.java +++ b/src/main/java/me/Danker/DankersSkyblockMod.java @@ -2741,13 +2741,13 @@ public class DankersSkyblockMod } if (ToggleCommand.clickInOrderToggled && chestName.equals("Click in order!")) { - if(terminalNumberNeeded[0] == 0) terminalNumberNeeded[0] = 14; + if(terminalNumberNeeded[0] == 0) terminalNumberNeeded[0] = 15; for(int i = 10; i <= 25; i++) { if (i == 17 || i == 18) continue; ItemStack prevStack = invSlots.get(terminalNumberNeeded[1]).getStack(); - if (prevStack == null) terminalNumberNeeded[0] = 14; - else if (prevStack.getItem() != Item.getItemFromBlock(Blocks.stained_glass_pane)) terminalNumberNeeded[0] = 14; - else if (prevStack.getItemDamage() == 5) terminalNumberNeeded[0] = 14; + if (prevStack == null) terminalNumberNeeded[0] = 15; + else if (prevStack.getItem() != Item.getItemFromBlock(Blocks.stained_glass_pane)) terminalNumberNeeded[0] = 15; + else if (prevStack.getItemDamage() == 5) terminalNumberNeeded[0] = 15; ItemStack itemStack = invSlots.get(i).getStack(); if (itemStack == null) continue; -- cgit