aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/me/Danker/DankersSkyblockMod.java3
-rw-r--r--src/main/java/me/Danker/commands/DHelpCommand.java2
-rw-r--r--src/main/java/me/Danker/commands/DankerGuiCommand.java1
-rw-r--r--src/main/java/me/Danker/commands/ToggleCommand.java11
-rw-r--r--src/main/java/me/Danker/features/BlockPlacingFlowers.java (renamed from src/main/java/me/Danker/features/puzzlesolvers/BlockPlacingFlowers.java)2
-rw-r--r--src/main/java/me/Danker/features/puzzlesolvers/IceWalkSolver.java287
-rw-r--r--src/main/java/me/Danker/features/puzzlesolvers/SilverfishSolver.java5
-rw-r--r--src/main/java/me/Danker/gui/PuzzleSolversGui.java17
-rw-r--r--src/main/java/me/Danker/handlers/ConfigHandler.java2
-rw-r--r--src/main/java/me/Danker/utils/IceWalkUtils.java99
10 files changed, 418 insertions, 11 deletions
diff --git a/src/main/java/me/Danker/DankersSkyblockMod.java b/src/main/java/me/Danker/DankersSkyblockMod.java
index dbb79dc..ab042d6 100644
--- a/src/main/java/me/Danker/DankersSkyblockMod.java
+++ b/src/main/java/me/Danker/DankersSkyblockMod.java
@@ -59,7 +59,7 @@ import java.util.Map;
@Mod(modid = DankersSkyblockMod.MODID, version = DankersSkyblockMod.VERSION, clientSideOnly = true)
public class DankersSkyblockMod {
public static final String MODID = "Danker's Skyblock Mod";
- public static final String VERSION = "1.8.6-beta2";
+ public static final String VERSION = "1.8.6-beta3";
public static int titleTimer = -1;
public static boolean showTitle = false;
public static String titleText = "";
@@ -104,6 +104,7 @@ public class DankersSkyblockMod {
MinecraftForge.EVENT_BUS.register(new GolemSpawningAlert());
MinecraftForge.EVENT_BUS.register(new GpartyNotifications());
MinecraftForge.EVENT_BUS.register(new HideTooltipsInExperiments());
+ MinecraftForge.EVENT_BUS.register(new IceWalkSolver());
MinecraftForge.EVENT_BUS.register(new LividSolver());
MinecraftForge.EVENT_BUS.register(new LootDisplay());
MinecraftForge.EVENT_BUS.register(new LootTracker());
diff --git a/src/main/java/me/Danker/commands/DHelpCommand.java b/src/main/java/me/Danker/commands/DHelpCommand.java
index c1ae5af..841d0b5 100644
--- a/src/main/java/me/Danker/commands/DHelpCommand.java
+++ b/src/main/java/me/Danker/commands/DHelpCommand.java
@@ -34,7 +34,7 @@ public class DHelpCommand extends CommandBase {
EnumChatFormatting.GOLD + " Commands, " + EnumChatFormatting.GREEN + " Keybinds.\n" +
EnumChatFormatting.GOLD + " /dhelp" + EnumChatFormatting.AQUA + " - Returns this message.\n" +
EnumChatFormatting.GOLD + " /dsm" + EnumChatFormatting.AQUA + " - Opens the GUI for Danker's Skyblock Mod.\n" +
- EnumChatFormatting.GOLD + " /toggle <gparty/coords/golden/slayercount/rngesusalerts/splitfishing/chatmaddox/spiritbearalerts/aotd/lividdagger/flowerweapons/sceptremessages/midasstaffmessages/implosionmessages/healmessages/cooldownmessages/manamessages/killcombomessages/petcolors/dungeontimer/golemalerts/expertiselore/skill50display/outlinetext/caketimer/lowhealthnotify/lividsolver/stopsalvagestarred/notifyslayerslain/autoskilltracker/necronnotifications/bonzotimer/threemanpuzzle/oruopuzzle/blazepuzzle/creeperpuzzle/waterpuzzle/tictactoepuzzle/boulderpuzzle/silverfishpuzzle/watchermessage/startswithterminal/selectallterminal/clickinorderterminal/blockwrongterminalclicks/itemframeonsealanterns/ultrasequencer/chronomatron/superpairs/hidetooltipsinaddons/pickblock/list>" + EnumChatFormatting.AQUA + " - Toggles features. /toggle list returns values of every toggle.\n" +
+ EnumChatFormatting.GOLD + " /toggle <gparty/coords/golden/slayercount/rngesusalerts/splitfishing/chatmaddox/spiritbearalerts/aotd/lividdagger/flowerweapons/sceptremessages/midasstaffmessages/implosionmessages/healmessages/cooldownmessages/manamessages/killcombomessages/petcolors/dungeontimer/golemalerts/expertiselore/skill50display/outlinetext/caketimer/lowhealthnotify/lividsolver/stopsalvagestarred/notifyslayerslain/autoskilltracker/necronnotifications/bonzotimer/threemanpuzzle/oruopuzzle/blazepuzzle/creeperpuzzle/waterpuzzle/tictactoepuzzle/boulderpuzzle/silverfishpuzzle/icewalkpuzzle/watchermessage/startswithterminal/selectallterminal/clickinorderterminal/blockwrongterminalclicks/itemframeonsealanterns/ultrasequencer/chronomatron/superpairs/hidetooltipsinaddons/pickblock/list>" + EnumChatFormatting.AQUA + " - Toggles features. /toggle list returns values of every toggle.\n" +
EnumChatFormatting.GOLD + " /setkey <key>" + EnumChatFormatting.AQUA + " - Sets API key.\n" +
EnumChatFormatting.GOLD + " /getkey" + EnumChatFormatting.AQUA + " - Returns key set with /setkey and copies it to your clipboard.\n" +
EnumChatFormatting.GOLD + " /loot <zombie/spider/wolf/fishing/catacombs/mythological/> [winter/festival/spooky/f(1-7)/session]" + EnumChatFormatting.AQUA + " - Returns loot received from slayer quests or fishing stats. /loot fishing winter returns winter sea creatures instead.\n" +
diff --git a/src/main/java/me/Danker/commands/DankerGuiCommand.java b/src/main/java/me/Danker/commands/DankerGuiCommand.java
index fff1ce7..bd92b3e 100644
--- a/src/main/java/me/Danker/commands/DankerGuiCommand.java
+++ b/src/main/java/me/Danker/commands/DankerGuiCommand.java
@@ -77,6 +77,7 @@ public class DankerGuiCommand extends CommandBase {
debug.append("[tictactoepuzzle][").append(ToggleCommand.ticTacToeToggled).append("]\n");
debug.append("[boulderpuzzle][").append(ToggleCommand.boulderToggled).append("]\n");
debug.append("[silverfishpuzzle][").append(ToggleCommand.silverfishToggled).append("]\n");
+ debug.append("[icewalkpuzzle][").append(ToggleCommand.iceWalkToggled).append("]\n");
debug.append("[watchermessage][").append(ToggleCommand.watcherReadyToggled).append("]\n");
debug.append("[startswithterminal][").append(ToggleCommand.startsWithToggled).append("]\n");
debug.append("[selectallterminal][").append(ToggleCommand.selectAllToggled).append("]\n");
diff --git a/src/main/java/me/Danker/commands/ToggleCommand.java b/src/main/java/me/Danker/commands/ToggleCommand.java
index 294cf1a..06619ac 100644
--- a/src/main/java/me/Danker/commands/ToggleCommand.java
+++ b/src/main/java/me/Danker/commands/ToggleCommand.java
@@ -58,6 +58,7 @@ public class ToggleCommand extends CommandBase implements ICommand {
public static boolean ticTacToeToggled;
public static boolean boulderToggled;
public static boolean silverfishToggled;
+ public static boolean iceWalkToggled;
// Terminal Helpers
public static boolean startsWithToggled;
public static boolean selectAllToggled;
@@ -83,7 +84,7 @@ public class ToggleCommand extends CommandBase implements ICommand {
"skill50display/outlinetext/midasstaffmessages/implosionmessages/healmessages/cooldownmessages/" +
"manamessages/killcombomessages/caketimer/lowhealthnotify/lividsolver/stopsalvagestarred/" +
"notifyslayerslain/necronnotifications/bonzotimer/threemanpuzzle/oruopuzzle/blazepuzzle/" +
- "creeperpuzzle/waterpuzzle/tictactoepuzzle/boulderpuzzle/silverfishpuzzle/watchermessage/" +
+ "creeperpuzzle/waterpuzzle/tictactoepuzzle/boulderpuzzle/silverfishpuzzle/icewalkpuzzle/watchermessage/" +
"startswithterminal/selectallterminal/clickinorderterminal/blockwrongterminalclicks/" +
"itemframeonsealanterns/ultrasequencer/chronomatron/superpairs/hidetooltipsinaddons/pickblock/list>";
}
@@ -105,7 +106,7 @@ public class ToggleCommand extends CommandBase implements ICommand {
"stopsalvagestarred", "notifyslayerslain", "necronnotifications",
"bonzotimer", "threemanpuzzle", "oruopuzzle", "blazepuzzle",
"creeperpuzzle", "waterpuzzle", "tictactoepuzzle", "boulderpuzzle",
- "silverfishpuzzle", "watchermessage", "startswithterminal",
+ "silverfishpuzzle", "icewalkpuzzle", "watchermessage", "startswithterminal",
"selectallterminal", "clickinorderterminal", "blockwrongterminalclicks",
"itemframeonsealanterns", "ultrasequencer", "chronomatron", "superpairs",
"hidetooltipsinaddons", "pickblock", "list");
@@ -324,6 +325,11 @@ public class ToggleCommand extends CommandBase implements ICommand {
ConfigHandler.writeBooleanConfig("toggles", "SilverfishPuzzle", silverfishToggled);
player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Silverfish puzzle solver has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + silverfishToggled + DankersSkyblockMod.MAIN_COLOUR + "."));
break;
+ case "icewalkpuzzle":
+ iceWalkToggled = !iceWalkToggled;
+ ConfigHandler.writeBooleanConfig("toggles", "IceWalkPuzzle", iceWalkToggled);
+ player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Ice walk puzzle solver has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + iceWalkToggled + DankersSkyblockMod.MAIN_COLOUR + "."));
+ break;
case "watchermessage":
watcherReadyToggled = !watcherReadyToggled;
ConfigHandler.writeBooleanConfig("toggles", "WatcherReadyMessage", watcherReadyToggled);
@@ -416,6 +422,7 @@ public class ToggleCommand extends CommandBase implements ICommand {
DankersSkyblockMod.TYPE_COLOUR + " Tic tac toe puzzle solver: " + DankersSkyblockMod.VALUE_COLOUR + ticTacToeToggled + "\n" +
DankersSkyblockMod.TYPE_COLOUR + " Boulder puzzle solver: " + DankersSkyblockMod.VALUE_COLOUR + boulderToggled + "\n" +
DankersSkyblockMod.TYPE_COLOUR + " Silverfish puzzle solver: " + DankersSkyblockMod.VALUE_COLOUR + silverfishToggled + "\n" +
+ DankersSkyblockMod.TYPE_COLOUR + " Ice walk puzzle solver: " + DankersSkyblockMod.VALUE_COLOUR + iceWalkToggled + "\n" +
DankersSkyblockMod.TYPE_COLOUR + " Watcher ready message: " + DankersSkyblockMod.VALUE_COLOUR + watcherReadyToggled + "\n" +
DankersSkyblockMod.TYPE_COLOUR + " Starts with letter terminal solver: " + DankersSkyblockMod.VALUE_COLOUR + startsWithToggled + "\n" +
DankersSkyblockMod.TYPE_COLOUR + " Select all color items terminal solver: " + DankersSkyblockMod.VALUE_COLOUR + selectAllToggled + "\n" +
diff --git a/src/main/java/me/Danker/features/puzzlesolvers/BlockPlacingFlowers.java b/src/main/java/me/Danker/features/BlockPlacingFlowers.java
index fe89fef..9bfc986 100644
--- a/src/main/java/me/Danker/features/puzzlesolvers/BlockPlacingFlowers.java
+++ b/src/main/java/me/Danker/features/BlockPlacingFlowers.java
@@ -1,4 +1,4 @@
-package me.Danker.features.puzzlesolvers;
+package me.Danker.features;
import me.Danker.commands.ToggleCommand;
import me.Danker.utils.Utils;
diff --git a/src/main/java/me/Danker/features/puzzlesolvers/IceWalkSolver.java b/src/main/java/me/Danker/features/puzzlesolvers/IceWalkSolver.java
new file mode 100644
index 0000000..eaabf6e
--- /dev/null
+++ b/src/main/java/me/Danker/features/puzzlesolvers/IceWalkSolver.java
@@ -0,0 +1,287 @@
+package me.Danker.features.puzzlesolvers;
+
+import me.Danker.DankersSkyblockMod;
+import me.Danker.commands.ToggleCommand;
+import me.Danker.utils.IceWalkUtils;
+import me.Danker.utils.Utils;
+import net.minecraft.block.Block;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.entity.EntityPlayerSP;
+import net.minecraft.init.Blocks;
+import net.minecraft.util.BlockPos;
+import net.minecraft.util.EnumFacing;
+import net.minecraft.util.Vec3;
+import net.minecraft.world.World;
+import net.minecraftforge.client.event.RenderWorldLastEvent;
+import net.minecraftforge.event.world.WorldEvent;
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
+import net.minecraftforge.fml.common.gameevent.TickEvent;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+public class IceWalkSolver {
+
+ static boolean prevInIceWalkRoom = false;
+ static boolean inIceWalkRoom = false;
+ static BlockPos chest = null;
+ static EnumFacing silverfishRoomDirection = null;
+ static List<IceWalkUtils.Point> threeByThreeRoute = new ArrayList<>();
+ static List<IceWalkUtils.Point> fiveByFiveRoute = new ArrayList<>();
+ static List<IceWalkUtils.Point> sevenBySevenRoute = new ArrayList<>();
+ public static int ICE_WALK_LINE_COLOUR;
+
+ @SubscribeEvent
+ public void onWorldChange(WorldEvent.Load event) {
+ reset();
+ }
+
+ @SubscribeEvent
+ public void onTick(TickEvent.ClientTickEvent event) {
+ if (event.phase != TickEvent.Phase.START) return;
+
+ Minecraft mc = Minecraft.getMinecraft();
+ EntityPlayerSP player = mc.thePlayer;
+ World world = mc.theWorld;
+ if (DankersSkyblockMod.tickAmount % 20 == 0) {
+ if (ToggleCommand.iceWalkToggled && Utils.inDungeons && world != null && player != null) {
+ // multi thread block checking
+ new Thread(() -> {
+ boolean foundRoom = false;
+ prevInIceWalkRoom = inIceWalkRoom;
+ Iterable<BlockPos> blocks = BlockPos.getAllInBox(new BlockPos(player.posX - 27, 75, player.posZ - 27), new BlockPos(player.posX + 27, 75, player.posZ + 27));
+ for (BlockPos blockPos : blocks) {
+ Block block = world.getBlockState(blockPos).getBlock();
+ if (block == Blocks.chest) {
+ char[][] threeByThreeBoard = new char[4][3];
+ char[][] fiveByFiveBoard = new char[6][5];
+ char[][] sevenBySevenBoard = new char[8][7];
+
+ if (world.getBlockState(blockPos.add(0, 7, 2)).getBlock() == Blocks.iron_bars && world.getBlockState(blockPos.add(0, -3, 2)).getBlock() == Blocks.stone_brick_stairs) {
+ silverfishRoomDirection = EnumFacing.NORTH;
+ } else if (world.getBlockState(blockPos.add(-2, 7, 0)).getBlock() == Blocks.iron_bars && world.getBlockState(blockPos.add(-2, -3, 0)).getBlock() == Blocks.stone_brick_stairs) {
+ silverfishRoomDirection = EnumFacing.EAST;
+ } else if (world.getBlockState(blockPos.add(0, 7, -2)).getBlock() == Blocks.iron_bars && world.getBlockState(blockPos.add(0, -3, -2)).getBlock() == Blocks.stone_brick_stairs) {
+ silverfishRoomDirection = EnumFacing.SOUTH;
+ } else if (world.getBlockState(blockPos.add(2, 7, 0)).getBlock() == Blocks.iron_bars && world.getBlockState(blockPos.add(2, -3, 0)).getBlock() == Blocks.stone_brick_stairs) {
+ silverfishRoomDirection = EnumFacing.WEST;
+ } else {
+ return;
+ }
+
+ foundRoom = true;
+ inIceWalkRoom = true;
+ if (!prevInIceWalkRoom) {
+ chest = blockPos;
+ switch (silverfishRoomDirection) {
+ case NORTH:
+ for (int row = chest.getZ() + 3, xIteration = 0; xIteration < 8; row++, xIteration++) {
+ for (int column = chest.getX() - 3, yIteration = 0; yIteration < 7; column++, yIteration++) {
+ if (world.getBlockState(new BlockPos(column, 72, row)).getBlock() != Blocks.air) {
+ sevenBySevenBoard[xIteration][yIteration] = 'X';
+ }
+ }
+ }
+ for (int row = chest.getZ() + 12, xIteration = 0; xIteration < 6; row++, xIteration++) {
+ for (int column = chest.getX() - 2, yIteration = 0; yIteration < 5; column++, yIteration++) {
+ if (world.getBlockState(new BlockPos(column, 71, row)).getBlock() != Blocks.air) {
+ fiveByFiveBoard[xIteration][yIteration] = 'X';
+ }
+ }
+ }
+ for (int row = chest.getZ() + 19, xIteration = 0; xIteration < 4; row++, xIteration++) {
+ for (int column = chest.getX() - 1, yIteration = 0; yIteration < 3; column++, yIteration++) {
+ if (world.getBlockState(new BlockPos(column, 70, row)).getBlock() != Blocks.air) {
+ threeByThreeBoard[xIteration][yIteration] = 'X';
+ }
+ }
+ }
+ break;
+ case EAST:
+ for (int row = chest.getX() - 3, xIteration = 0; xIteration < 8; row--, xIteration++) {
+ for (int column = chest.getZ() - 3, yIteration = 0; yIteration < 7; column++, yIteration++) {
+ if (world.getBlockState(new BlockPos(row, 72, column)).getBlock() != Blocks.air) {
+ sevenBySevenBoard[xIteration][yIteration] = 'X';
+ }
+ }
+ }
+ for (int row = chest.getX() - 12, xIteration = 0; xIteration < 6; row--, xIteration++) {
+ for (int column = chest.getZ() - 2, yIteration = 0; yIteration < 5; column++, yIteration++) {
+ if (world.getBlockState(new BlockPos(row, 71, column)).getBlock() != Blocks.air) {
+ fiveByFiveBoard[xIteration][yIteration] = 'X';
+ }
+ }
+ }
+ for (int row = chest.getX() - 19, xIteration = 0; xIteration < 4; row--, xIteration++) {
+ for (int column = chest.getZ() - 1, yIteration = 0; yIteration < 3; column++, yIteration++) {
+ if (world.getBlockState(new BlockPos(row, 70, column)).getBlock() != Blocks.air) {
+ threeByThreeBoard[xIteration][yIteration] = 'X';
+ }
+ }
+ }
+ break;
+ case SOUTH:
+ for (int row = chest.getZ() - 3, xIteration = 0; xIteration < 8; row--, xIteration++) {
+ for (int column = chest.getX() + 3, yIteration = 0; yIteration < 7; column--, yIteration++) {
+ if (world.getBlockState(new BlockPos(column, 72, row)).getBlock() != Blocks.air) {
+ sevenBySevenBoard[xIteration][yIteration] = 'X';
+ }
+ }
+ }
+ for (int row = chest.getZ() - 12, xIteration = 0; xIteration < 6; row--, xIteration++) {
+ for (int column = chest.getX() + 2, yIteration = 0; yIteration < 5; column--, yIteration++) {
+ if (world.getBlockState(new BlockPos(column, 71, row)).getBlock() != Blocks.air) {
+ fiveByFiveBoard[xIteration][yIteration] = 'X';
+ }
+ }
+ }
+ for (int row = chest.getZ() - 19, xIteration = 0; xIteration < 4; row--, xIteration++) {
+ for (int column = chest.getX() + 1, yIteration = 0; yIteration < 3; column--, yIteration++) {
+ if (world.getBlockState(new BlockPos(column, 70, row)).getBlock() != Blocks.air) {
+ threeByThreeBoard[xIteration][yIteration] = 'X';
+ }
+ }
+ }
+ break;
+ case WEST:
+ for (int row = chest.getX() + 3, xIteration = 0; xIteration < 8; row++, xIteration++) {
+ for (int column = chest.getZ() + 3, yIteration = 0; yIteration < 7; column--, yIteration++) {
+ if (world.getBlockState(new BlockPos(row, 72, column)).getBlock() != Blocks.air) {
+ sevenBySevenBoard[xIteration][yIteration] = 'X';
+ }
+ }
+ }
+ for (int row = chest.getX() + 12, xIteration = 0; xIteration < 6; row++, xIteration++) {
+ for (int column = chest.getZ() + 2, yIteration = 0; yIteration < 5; column--, yIteration++) {
+ if (world.getBlockState(new BlockPos(row, 71, column)).getBlock() != Blocks.air) {
+ fiveByFiveBoard[xIteration][yIteration] = 'X';
+ }
+ }
+ }
+ for (int row = chest.getX() + 19, xIteration = 0; xIteration < 4; row++, xIteration++) {
+ for (int column = chest.getZ() + 1, yIteration = 0; yIteration < 3; column--, yIteration++) {
+ if (world.getBlockState(new BlockPos(row, 70, column)).getBlock() != Blocks.air) {
+ threeByThreeBoard[xIteration][yIteration] = 'X';
+ }
+ }
+ }
+ break;
+ }
+ System.out.println(Arrays.deepToString(threeByThreeBoard));
+ System.out.println(Arrays.deepToString(fiveByFiveBoard));
+ System.out.println(Arrays.deepToString(sevenBySevenBoard));
+
+ threeByThreeRoute = IceWalkUtils.solve(threeByThreeBoard);
+ fiveByFiveRoute = IceWalkUtils.solve(fiveByFiveBoard);
+ sevenBySevenRoute = IceWalkUtils.solve(sevenBySevenBoard);
+ }
+ }
+ }
+ if (!foundRoom) {
+ inIceWalkRoom = false;
+ reset();
+ }
+ }).start();
+ }
+ }
+ }
+
+ @SubscribeEvent
+ public void onWorldRender(RenderWorldLastEvent event) {
+ if (ToggleCommand.iceWalkToggled && Utils.inDungeons && chest != null) {
+ if (threeByThreeRoute != null && threeByThreeRoute.size() > 1) {
+ for (int i = 0; i < threeByThreeRoute.size() - 1; i++) {
+ Vec3 pos1;
+ Vec3 pos2;
+ switch (silverfishRoomDirection) {
+ case NORTH:
+ pos1 = new Vec3(chest.getX() - 0.5 + threeByThreeRoute.get(i).column, 70.5, chest.getZ() + 19.5 + threeByThreeRoute.get(i).row);
+ pos2 = new Vec3(chest.getX() - 0.5 + threeByThreeRoute.get(i + 1).column, 70.5, chest.getZ() + 19.5 + threeByThreeRoute.get(i + 1).row);
+ break;
+ case EAST:
+ pos1 = new Vec3(chest.getX() - 18.5 - threeByThreeRoute.get(i).row, 70.5, chest.getZ() - 0.5 + threeByThreeRoute.get(i).column);
+ pos2 = new Vec3(chest.getX() - 18.5 - threeByThreeRoute.get(i + 1).row, 70.5, chest.getZ() - 0.5 + threeByThreeRoute.get(i + 1).column);
+ break;
+ case SOUTH:
+ pos1 = new Vec3(chest.getX() + 1.5 - threeByThreeRoute.get(i).column, 70.5, chest.getZ() - 18.5 - threeByThreeRoute.get(i).row);
+ pos2 = new Vec3(chest.getX() + 1.5 - threeByThreeRoute.get(i + 1).column, 70.5, chest.getZ() - 18.5 - threeByThreeRoute.get(i + 1).row);
+ break;
+ case WEST:
+ pos1 = new Vec3(chest.getX() + 19.5 + threeByThreeRoute.get(i).row, 70.5, chest.getZ() + 1.5 - threeByThreeRoute.get(i).column);
+ pos2 = new Vec3(chest.getX() + 19.5 + threeByThreeRoute.get(i + 1).row, 70.5, chest.getZ() + 1.5 - threeByThreeRoute.get(i + 1).column);
+ break;
+ default:
+ return;
+ }
+ Utils.draw3DLine(pos1, pos2, ICE_WALK_LINE_COLOUR, 5, true, event.partialTicks);
+ }
+ }
+
+ if (fiveByFiveRoute != null && fiveByFiveRoute.size() > 1) {
+ for (int i = 0; i < fiveByFiveRoute.size() - 1; i++) {
+ Vec3 pos1;
+ Vec3 pos2;
+ switch (silverfishRoomDirection) {
+ case NORTH:
+ pos1 = new Vec3(chest.getX() - 1.5 + fiveByFiveRoute.get(i).column, 71.5, chest.getZ() + 12.5 + fiveByFiveRoute.get(i).row);
+ pos2 = new Vec3(chest.getX() - 1.5 + fiveByFiveRoute.get(i + 1).column, 71.5, chest.getZ() + 12.5 + fiveByFiveRoute.get(i + 1).row);
+ break;
+ case EAST:
+ pos1 = new Vec3(chest.getX() - 11.5 - fiveByFiveRoute.get(i).row, 71.5, chest.getZ() - 1.5 + fiveByFiveRoute.get(i).column);
+ pos2 = new Vec3(chest.getX() - 11.5 - fiveByFiveRoute.get(i + 1).row, 71.5, chest.getZ() - 1.5 + fiveByFiveRoute.get(i + 1).column);
+ break;
+ case SOUTH:
+ pos1 = new Vec3(chest.getX() + 2.5 - fiveByFiveRoute.get(i).column, 71.5, chest.getZ() - 11.5 - fiveByFiveRoute.get(i).row);
+ pos2 = new Vec3(chest.getX() + 2.5 - fiveByFiveRoute.get(i + 1).column, 71.5, chest.getZ() - 11.5 - fiveByFiveRoute.get(i + 1).row);
+ break;
+ case WEST:
+ pos1 = new Vec3(chest.getX() + 12.5 + fiveByFiveRoute.get(i).row, 71.5, chest.getZ() + 2.5 - fiveByFiveRoute.get(i).column);
+ pos2 = new Vec3(chest.getX() + 12.5 + fiveByFiveRoute.get(i + 1).row, 71.5, chest.getZ() + 2.5 - fiveByFiveRoute.get(i + 1).column);
+ break;
+ default:
+ return;
+ }
+ Utils.draw3DLine(pos1, pos2, ICE_WALK_LINE_COLOUR, 5, true, event.partialTicks);
+ }
+ }
+
+ if (sevenBySevenRoute != null && sevenBySevenRoute.size() > 1) {
+ for (int i = 0; i < sevenBySevenRoute.size() - 1; i++) {
+ Vec3 pos1;
+ Vec3 pos2;
+ switch (silverfishRoomDirection) {
+ case NORTH:
+ pos1 = new Vec3(chest.getX() - 2.5 + sevenBySevenRoute.get(i).column, 72.5, chest.getZ() + 3.5 + sevenBySevenRoute.get(i).row);
+ pos2 = new Vec3(chest.getX() - 2.5 + sevenBySevenRoute.get(i + 1).column, 72.5, chest.getZ() + 3.5 + sevenBySevenRoute.get(i + 1).row);
+ break;
+ case EAST:
+ pos1 = new Vec3(chest.getX() - 2.5 - sevenBySevenRoute.get(i).row, 72.5, chest.getZ() - 2.5 + sevenBySevenRoute.get(i).column);
+ pos2 = new Vec3(chest.getX() - 2.5 - sevenBySevenRoute.get(i + 1).row, 72.5, chest.getZ() - 2.5 + sevenBySevenRoute.get(i + 1).column);
+ break;
+ case SOUTH:
+ pos1 = new Vec3(chest.getX() + 3.5 - sevenBySevenRoute.get(i).column, 72.5, chest.getZ() - 2.5 - sevenBySevenRoute.get(i).row);
+ pos2 = new Vec3(chest.getX() + 3.5 - sevenBySevenRoute.get(i + 1).column, 72.5, chest.getZ() - 2.5 - sevenBySevenRoute.get(i + 1).row);
+ break;
+ case WEST:
+ pos1 = new Vec3(chest.getX() + 3.5 + sevenBySevenRoute.get(i).row, 72.5, chest.getZ() + 3.5 - sevenBySevenRoute.get(i).column);
+ pos2 = new Vec3(chest.getX() + 3.5 + sevenBySevenRoute.get(i + 1).row, 72.5, chest.getZ() + 3.5 - sevenBySevenRoute.get(i + 1).column);
+ break;
+ default:
+ return;
+ }
+ Utils.draw3DLine(pos1, pos2, ICE_WALK_LINE_COLOUR, 5, true, event.partialTicks);
+ }
+ }
+ }
+ }
+
+ static void reset() {
+ silverfishRoomDirection = null;
+ chest = null;
+ threeByThreeRoute.clear();
+ fiveByFiveRoute.clear();
+ sevenBySevenRoute.clear();
+ }
+
+}
diff --git a/src/main/java/me/Danker/features/puzzlesolvers/SilverfishSolver.java b/src/main/java/me/Danker/features/puzzlesolvers/SilverfishSolver.java
index c07524d..575dcd3 100644
--- a/src/main/java/me/Danker/features/puzzlesolvers/SilverfishSolver.java
+++ b/src/main/java/me/Danker/features/puzzlesolvers/SilverfishSolver.java
@@ -12,7 +12,10 @@ import net.minecraft.entity.monster.EntitySilverfish;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.*;
+import net.minecraft.util.AxisAlignedBB;
+import net.minecraft.util.BlockPos;
+import net.minecraft.util.EnumFacing;
+import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraftforge.client.event.RenderWorldLastEvent;
import net.minecraftforge.event.world.WorldEvent;
diff --git a/src/main/java/me/Danker/gui/PuzzleSolversGui.java b/src/main/java/me/Danker/gui/PuzzleSolversGui.java
index 3864b80..3bb16a0 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 boulder;
private GuiButton silverfish;
+ private GuiButton iceWalk;
private GuiButton startsWith;
private GuiButton selectAll;
private GuiButton clickOrder;
@@ -61,11 +62,12 @@ public class PuzzleSolversGui extends GuiScreen {
boulder = new GuiButton(0, width / 2 - 100, (int) (height * 0.7), "Boulder Solver: " + Utils.getColouredBoolean(ToggleCommand.boulderToggled));
// Page 2
silverfish = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Silverfish Solver: " + Utils.getColouredBoolean(ToggleCommand.silverfishToggled));
- startsWith = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Starts With Letter Terminal Solver: " + Utils.getColouredBoolean(ToggleCommand.startsWithToggled));
- selectAll = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "Select All Color Terminal Solver: " + Utils.getColouredBoolean(ToggleCommand.selectAllToggled));
- clickOrder = new GuiButton(0, width / 2 - 100, (int) (height * 0.4), "Click in Order Terminal Helper: " + Utils.getColouredBoolean(ToggleCommand.clickInOrderToggled));
- blockClicks = new GuiButton(0, width / 2 - 100, (int) (height * 0.5), "Block Wrong Clicks on Terminals: " + Utils.getColouredBoolean(ToggleCommand.blockWrongTerminalClicksToggled));
- itemFrameOnSeaLanterns = new GuiButton(0, width / 2 - 100, (int) (height * 0.6), "Ignore Arrows On Sea Lanterns: " + Utils.getColouredBoolean(ToggleCommand.itemFrameOnSeaLanternsToggled));
+ iceWalk = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Ice Walk Solver: " + Utils.getColouredBoolean(ToggleCommand.iceWalkToggled));
+ startsWith = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "Starts With Letter Terminal Solver: " + Utils.getColouredBoolean(ToggleCommand.startsWithToggled));
+ selectAll = new GuiButton(0, width / 2 - 100, (int) (height * 0.4), "Select All Color Terminal Solver: " + Utils.getColouredBoolean(ToggleCommand.selectAllToggled));
+ clickOrder = new GuiButton(0, width / 2 - 100, (int) (height * 0.5), "Click in Order Terminal Helper: " + Utils.getColouredBoolean(ToggleCommand.clickInOrderToggled));
+ blockClicks = new GuiButton(0, width / 2 - 100, (int) (height * 0.6), "Block Wrong Clicks on Terminals: " + Utils.getColouredBoolean(ToggleCommand.blockWrongTerminalClicksToggled));
+ itemFrameOnSeaLanterns = new GuiButton(0, width / 2 - 100, (int) (height * 0.7), "Ignore Arrows On Sea Lanterns: " + Utils.getColouredBoolean(ToggleCommand.itemFrameOnSeaLanternsToggled));
switch (page) {
case 1:
@@ -80,6 +82,7 @@ public class PuzzleSolversGui extends GuiScreen {
break;
case 2:
this.buttonList.add(silverfish);
+ this.buttonList.add(iceWalk);
this.buttonList.add(startsWith);
this.buttonList.add(selectAll);
this.buttonList.add(clickOrder);
@@ -137,6 +140,10 @@ public class PuzzleSolversGui extends GuiScreen {
ToggleCommand.silverfishToggled = !ToggleCommand.silverfishToggled;
ConfigHandler.writeBooleanConfig("toggles", "SilverfishPuzzle", ToggleCommand.silverfishToggled);
silverfish.displayString = "Silverfish Solver: " + Utils.getColouredBoolean(ToggleCommand.silverfishToggled);
+ } else if (button == iceWalk) {
+ ToggleCommand.iceWalkToggled = !ToggleCommand.iceWalkToggled;
+ ConfigHandler.writeBooleanConfig("toggles", "IceWalkPuzzle", ToggleCommand.iceWalkToggled);
+ iceWalk.displayString = "Ice Walk Solver: " + Utils.getColouredBoolean(ToggleCommand.iceWalkToggled);
} 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 52b1883..19edeff 100644
--- a/src/main/java/me/Danker/handlers/ConfigHandler.java
+++ b/src/main/java/me/Danker/handlers/ConfigHandler.java
@@ -254,6 +254,7 @@ public class ConfigHandler {
ToggleCommand.ticTacToeToggled = initBoolean("toggles", "TicTacToePuzzle", false);
ToggleCommand.boulderToggled = initBoolean("toggles", "BoulderPuzzle", false);
ToggleCommand.silverfishToggled = initBoolean("toggles", "SilverfishPuzzle", false);
+ ToggleCommand.iceWalkToggled = initBoolean("toggles", "IceWalkPuzzle", false);
ToggleCommand.startsWithToggled = initBoolean("toggles", "StartsWithTerminal", false);
ToggleCommand.selectAllToggled = initBoolean("toggles", "SelectAllTerminal", false);
ToggleCommand.clickInOrderToggled = initBoolean("toggles", "ClickInOrderTerminal", false);
@@ -513,6 +514,7 @@ public class ConfigHandler {
BoulderSolver.BOULDER_COLOUR = initInt("colors", "boulder", 0x197F19);
BoulderSolver.BOULDER_ARROW_COLOUR = initInt("colors", "boulderArrow", 0x006000);
SilverfishSolver.SILVERFISH_LINE_COLOUR = initInt("colors", "silverfishLine", 0x40FF40);
+ IceWalkSolver.ICE_WALK_LINE_COLOUR = initInt("colors", "iceWalkLine", 0x40FF40);
// Commands
if (!hasKey("commands", "reparty")) writeBooleanConfig("commands", "reparty", false);
diff --git a/src/main/java/me/Danker/utils/IceWalkUtils.java b/src/main/java/me/Danker/utils/IceWalkUtils.java
new file mode 100644
index 0000000..8164fe1
--- /dev/null
+++ b/src/main/java/me/Danker/utils/IceWalkUtils.java
@@ -0,0 +1,99 @@
+package me.Danker.utils;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+
+public class IceWalkUtils {
+
+ public static List<Point> solve(char[][] board) {
+ Point startPos = new Point(board.length - 1, board[0].length / 2);
+ Point endPos = new Point(0, board[0].length / 2);
+ List<Point> route = new ArrayList<>();
+ route.add(startPos);
+ return findSolution(board, startPos, endPos, route);
+ }
+
+ public static List<Point> findSolution(char[][] board, Point startPos, Point endPos, List<Point> route) {
+ for (Direction direction : Direction.values()) {
+ Point nextPoint = move(board, startPos, direction);
+ if (nextPoint == null || route.contains(nextPoint)) continue;
+ List<Point> newRoute = new ArrayList<>(route);
+ newRoute.add(nextPoint);
+ if (nextPoint.equals(endPos) && isComplete(board, newRoute)) return newRoute;
+ List<Point> solution = findSolution(board, nextPoint, endPos, newRoute);
+ if (solution == null) continue;
+ return solution;
+ }
+ return null;
+ }
+
+ public static Point move(char[][] board, Point pos, Direction direction) {
+ switch (direction) {
+ case UP:
+ if (pos.row != 0 && board[pos.row - 1][pos.column] != 'X') {
+ return new Point(pos.row - 1, pos.column);
+ }
+ break;
+ case DOWN:
+ if (pos.row != board.length - 1 && board[pos.row + 1][pos.column] != 'X') {
+ return new Point(pos.row + 1, pos.column);
+ }
+ break;
+ case LEFT:
+ if (pos.column != 0 && board[pos.row][pos.column - 1] != 'X') {
+ return new Point(pos.row, pos.column - 1);
+ }
+ break;
+ case RIGHT:
+ if (pos.column != board[0].length - 1 && board[pos.row][pos.column + 1] != 'X') {
+ return new Point(pos.row, pos.column + 1);
+ }
+ break;
+ }
+ return null;
+ }
+
+ public static boolean isComplete(char[][] board, List<Point> route) {
+ for (int row = 0; row < board.length; row++) {
+ for (int column = 0; column < board[0].length; column++) {
+ if (board[row][column] != 'X' && !route.contains(new Point(row, column))) return false;
+ }
+ }
+ return true;
+ }
+
+ public static class Point {
+
+ public int row;
+ public int column;
+
+ public Point(int row, int column) {
+ this.row = row;
+ this.column = column;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(row, column);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof Point) {
+ Point point = (Point) obj;
+ return row == point.row && column == point.column;
+ }
+ return false;
+ }
+
+ }
+
+ enum Direction {
+ UP,
+ DOWN,
+ LEFT,
+ RIGHT
+ }
+
+}