From 31a53cbc4933c2a3b8ec11d4f55a67e42a4942ce Mon Sep 17 00:00:00 2001 From: My-Name-Is-Jeff <37018278+My-Name-Is-Jeff@users.noreply.github.com> Date: Tue, 15 Dec 2020 20:51:11 -0500 Subject: Feature: Necron Notifications --- src/main/java/me/Danker/DankersSkyblockMod.java | 52 ++++++++++++++++++++++ src/main/java/me/Danker/commands/DHelpCommand.java | 2 +- .../java/me/Danker/commands/DankerGuiCommand.java | 1 + .../java/me/Danker/commands/ToggleCommand.java | 9 +++- src/main/java/me/Danker/gui/DankerGui.java | 7 +++ .../java/me/Danker/handlers/ConfigHandler.java | 2 + 6 files changed, 70 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/main/java/me/Danker/DankersSkyblockMod.java b/src/main/java/me/Danker/DankersSkyblockMod.java index 77102bc..87fdd23 100644 --- a/src/main/java/me/Danker/DankersSkyblockMod.java +++ b/src/main/java/me/Danker/DankersSkyblockMod.java @@ -7,6 +7,8 @@ import me.Danker.handlers.*; import me.Danker.utils.TicTacToeUtils; import me.Danker.utils.Utils; import net.minecraft.block.Block; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.gui.Gui; @@ -16,6 +18,7 @@ import net.minecraft.client.gui.inventory.GuiChest; import net.minecraft.client.settings.GameSettings; import net.minecraft.client.settings.KeyBinding; import net.minecraft.entity.Entity; +import net.minecraft.entity.item.EntityArmorStand; import net.minecraft.entity.item.EntityItemFrame; import net.minecraft.entity.monster.EntityCreeper; import net.minecraft.entity.monster.EntitySpider; @@ -459,6 +462,55 @@ public class DankersSkyblockMod } } } + + if (ToggleCommand.necronNotificationsToggled && Utils.inDungeons && message.contains("[BOSS] Necron:")) { + Minecraft mc = Minecraft.getMinecraft(); + World world = mc.theWorld; + if (message.contains("You tricked me!") || message.contains("That beam, it hurts! IT HURTS!!")) { + Utils.createTitle(EnumChatFormatting.RED + "NECRON STUCK!", 2); + } else if (message.contains("STOP USING MY FACTORY AGAINST ME!") || message.contains("OOF") || message.contains("ANOTHER TRAP!! YOUR TRICKS ARE FUTILE!") || message.contains("SERIOUSLY? AGAIN?!") || message.contains("STOP!!!!!")) { + List necronLabels = world.getEntities(EntityArmorStand.class, (entity->{ + if (!entity.hasCustomName()) return false; + if (!entity.getCustomNameTag().contains("Necron")) return false; + return true; + })); + if(necronLabels.size() == 0) { + Utils.createTitle(EnumChatFormatting.WHITE + "NECRON STUNNED!", 2); + } else { + EntityArmorStand necron = necronLabels.get(0); + double x = necron.posX; + double z = necron.posZ; + + BlockPos blockPos = new BlockPos(x, 168, z); + + IBlockState blockState = world.getBlockState(blockPos); + Block block = blockState.getBlock(); + + if (block != Blocks.stained_hardened_clay) { + Utils.createTitle(EnumChatFormatting.WHITE + "NECRON STUNNED!", 2); + } else { + switch (block.getDamageValue(world, blockPos)) { + case 4: + Utils.createTitle(EnumChatFormatting.YELLOW + "YELLOW PILLAR!", 2); + break; + case 5: + Utils.createTitle(EnumChatFormatting.GREEN + "LIME PILLAR!", 2); + break; + case 11: + Utils.createTitle(EnumChatFormatting.BLUE + "BLUE PILLAR!", 2); + break; + default: + Utils.createTitle(EnumChatFormatting.WHITE + "NECRON STUNNED!", 2); + } + } + + } + } else if (message.contains("I'VE HAD ENOUGH! YOU'RE NOT HITTING ME WITH ANY MORE PILLARS!")) { + Utils.createTitle(EnumChatFormatting.RED + "RED PILLAR!", 2); + } else if (message.contains("ARGH!")) { + Utils.createTitle(EnumChatFormatting.RED + "EXPLOSION OVER!", 2); + } + } if (message.contains("[BOSS] The Watcher: You have proven yourself. You may pass.")) { watcherClearTime = System.currentTimeMillis() / 1000; diff --git a/src/main/java/me/Danker/commands/DHelpCommand.java b/src/main/java/me/Danker/commands/DHelpCommand.java index b2f6824..e4e7037 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..813624e 100644 --- a/src/main/java/me/Danker/commands/DankerGuiCommand.java +++ b/src/main/java/me/Danker/commands/DankerGuiCommand.java @@ -59,6 +59,7 @@ public class DankerGuiCommand extends CommandBase { 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("[necronnotifications][").append(ToggleCommand.necronNotificationsToggled).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 3b1c04d..30cbcc5 100644 --- a/src/main/java/me/Danker/commands/ToggleCommand.java +++ b/src/main/java/me/Danker/commands/ToggleCommand.java @@ -40,6 +40,7 @@ public class ToggleCommand extends CommandBase implements ICommand { public static boolean watcherReadyToggled; public static boolean swapToPickBlockToggled; public static boolean notifySlayerSlainToggled; + public static boolean necronNotificationsToggled; // Puzzle Solvers public static boolean threeManToggled; public static boolean oruoToggled; @@ -69,7 +70,7 @@ public class ToggleCommand extends CommandBase implements ICommand { return "/" + getCommandName() + " "; } @@ -86,7 +87,7 @@ public class ToggleCommand extends CommandBase implements ICommand { "sceptremessages", "petcolors", "dungeontimer", "golemalerts", "expertiselore", "skill50display", "outlinetext", "midasstaffmessages", "implosionmessages", "healmessages", "caketimer", "lowhealthnotify", - "lividsolver", "stopsalvagestarred", "notifyslayerslain", "threemanpuzzle", "oruopuzzle", "blazepuzzle", + "lividsolver", "stopsalvagestarred", "notifyslayerslain", "necronnotifications", "threemanpuzzle", "oruopuzzle", "blazepuzzle", "creeperpuzzle", "waterpuzzle", "tictactoepuzzle", "watchermessage", "startswithterminal", "selectallterminal", "clickinorderterminal", "blockwrongterminalclicks", "itemframeonsealanterns", "ultrasequencer", "chronomatron", "superpairs", "hidetooltipsinaddons", "pickblock", "list"); @@ -230,6 +231,10 @@ public class ToggleCommand extends CommandBase implements ICommand { 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 "necronnotifications": + necronNotificationsToggled = !necronNotificationsToggled; + ConfigHandler.writeBooleanConfig("toggles", "NecronNotifications", necronNotificationsToggled); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Necron phase notifications has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + necronNotificationsToggled + DankersSkyblockMod.MAIN_COLOUR + ".")); 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 ff6d5d0..86ab1aa 100644 --- a/src/main/java/me/Danker/gui/DankerGui.java +++ b/src/main/java/me/Danker/gui/DankerGui.java @@ -57,6 +57,7 @@ public class DankerGui extends GuiScreen { private GuiButton watcherReadyMessage; private GuiButton pickBlock; private GuiButton notifySlayerSlain; + private GuiButton necronNotifications; public DankerGui(int page) { this.page = page; @@ -119,6 +120,7 @@ public class DankerGui extends GuiScreen { 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)); + necronNotifications = new GuiButton(0, width / 2 - 100, (int) (height * 0.5), "Necron Phase Notifications: " + Utils.getColouredBoolean(ToggleCommand.necronNotificationsToggled)); switch (page) { case 1: @@ -169,6 +171,7 @@ public class DankerGui extends GuiScreen { this.buttonList.add(watcherReadyMessage); this.buttonList.add(splitFishing); this.buttonList.add(notifySlayerSlain); + this.buttonList.add(necronNotifications); this.buttonList.add(backPage); break; } @@ -321,6 +324,10 @@ public class DankerGui extends GuiScreen { ToggleCommand.notifySlayerSlainToggled = !ToggleCommand.notifySlayerSlainToggled; ConfigHandler.writeBooleanConfig("toggles", "NotifySlayerSlain", ToggleCommand.notifySlayerSlainToggled); notifySlayerSlain.displayString = "Notify when Slayer Slain: " + Utils.getColouredBoolean(ToggleCommand.notifySlayerSlainToggled); + } else if (button == necronNotifications) { + ToggleCommand.necronNotificationsToggled = !ToggleCommand.necronNotificationsToggled; + ConfigHandler.writeBooleanConfig("toggles", "NecronNotifications", ToggleCommand.necronNotificationsToggled); + necronNotifications.displayString = "Necron Phase Notifications: " + Utils.getColouredBoolean(ToggleCommand.necronNotificationsToggled); } 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 531d631..ce34b39 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -195,6 +195,8 @@ public class ConfigHandler { if (!hasKey("toggles", "WatcherReadyMessage")) writeBooleanConfig("toggles", "WatcherReadyMessage", false); if (!hasKey("toggles", "PickBlock")) writeBooleanConfig("toggles", "PickBlock", false); if (!hasKey("toggles", "NotifySlayerSlain")) writeBooleanConfig("toggles", "NotifySlayerSlain", false); + if (!hasKey("toggles", "NecronNotifications")) writeBooleanConfig("toggles", "NecronNotifications", false); + // Puzzle Solvers if (!hasKey("toggles", "ThreeManPuzzle")) writeBooleanConfig("toggles", "ThreeManPuzzle", false); if (!hasKey("toggles", "OruoPuzzle")) writeBooleanConfig("toggles", "OruoPuzzle", false); -- cgit