diff options
Diffstat (limited to 'me')
-rw-r--r-- | me/Danker/TheMod.java | 28 | ||||
-rw-r--r-- | me/Danker/commands/ToggleCommand.java | 15 | ||||
-rw-r--r-- | me/Danker/handlers/ConfigHandler.java | 2 | ||||
-rw-r--r-- | me/Danker/utils/Utils.java | 28 |
4 files changed, 68 insertions, 5 deletions
diff --git a/me/Danker/TheMod.java b/me/Danker/TheMod.java index 68badb2..b99ac42 100644 --- a/me/Danker/TheMod.java +++ b/me/Danker/TheMod.java @@ -55,6 +55,7 @@ import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; import net.minecraftforge.fml.common.versioning.DefaultArtifactVersion; @Mod(modid = TheMod.MODID, version = TheMod.VERSION, clientSideOnly = true) @@ -68,6 +69,9 @@ public class TheMod public static Map<String, String> t6Enchants = new HashMap<String, String>(); public static Pattern pattern = Pattern.compile(""); static boolean updateChecked = false; + public static int titleTimer = -1; + public static boolean showTitle = false; + public static String titleText = ""; @EventHandler public void init(FMLInitializationEvent event) @@ -245,12 +249,14 @@ public class TheMod lc.wolfEggs++; lc.wolfEggsSession++; cf.writeIntConfig("wolf", "egg", lc.wolfEggs); + if (tc.rngesusAlerts) Utils.createTitle(EnumChatFormatting.DARK_RED + "RED CLAW EGG!", 3); } if (message.contains("CRAZY RARE DROP! (") && message.contains(" Couture Rune I)")) { wolfRNG = true; lc.wolfCoutures++; lc.wolfCouturesSession++; cf.writeIntConfig("wolf", "couture", lc.wolfCoutures); + if (tc.rngesusAlerts) Utils.createTitle(EnumChatFormatting.GOLD + "COUTURE RUNE!", 3); } // How did Skyblock devs even manage to make this item Rename Me if (message.contains("CRAZY RARE DROP! (Grizzly Bait)") || message.contains("CRAZY RARE DROP! (Rename Me)")) { @@ -258,12 +264,14 @@ public class TheMod lc.wolfBaits++; lc.wolfBaitsSession++; cf.writeIntConfig("wolf", "bait", lc.wolfBaits); + if (tc.rngesusAlerts) Utils.createTitle(EnumChatFormatting.AQUA + "GRIZZLY BAIT!", 3); } if (message.contains("CRAZY RARE DROP! (Overflux Capacitor)")) { wolfRNG = true; lc.wolfFluxes++; lc.wolfFluxesSession++; cf.writeIntConfig("wolf", "flux", lc.wolfFluxes); + if (tc.rngesusAlerts) Utils.createTitle(EnumChatFormatting.DARK_PURPLE + "OVERFLUX CAPACITOR!", 5); } // Spider @@ -299,18 +307,21 @@ public class TheMod lc.spiderSwatters++; lc.spiderSwattersSession++; cf.writeIntConfig("spider", "swatter", lc.spiderSwatters); + if (tc.rngesusAlerts) Utils.createTitle(EnumChatFormatting.LIGHT_PURPLE + "FLY SWATTER!", 3); } if (message.contains("CRAZY RARE DROP! (Tarantula Talisman")) { spiderRNG = true; lc.spiderTalismans++; lc.spiderTalismansSession++; cf.writeIntConfig("spider", "talisman", lc.spiderTalismans); + if (tc.rngesusAlerts) Utils.createTitle(EnumChatFormatting.DARK_PURPLE + "TARANTULA TALISMAN!", 3); } if (message.contains("CRAZY RARE DROP! (Digested Mosquito)")) { spiderRNG = true; lc.spiderMosquitos++; lc.spiderMosquitosSession++; cf.writeIntConfig("spider", "mosquito", lc.spiderMosquitos); + if (tc.rngesusAlerts) Utils.createTitle(EnumChatFormatting.GOLD + "DIGESTED MOSQUITO!", 5); } // Zombie @@ -351,18 +362,21 @@ public class TheMod lc.zombieBeheadeds++; lc.zombieBeheadedsSession++; cf.writeIntConfig("zombie", "beheaded", lc.zombieBeheadeds); + if (tc.rngesusAlerts) Utils.createTitle(EnumChatFormatting.DARK_PURPLE + "BEHEADED HORROR!", 3); } if (message.contains("CRAZY RARE DROP! (") && message.contains(" Snake Rune I)")) { zombieRNG = true; lc.zombieSnakes++; lc.zombieSnakesSession++; cf.writeIntConfig("zombie", "snake", lc.zombieSnakes); + if (tc.rngesusAlerts) Utils.createTitle(EnumChatFormatting.DARK_GREEN + "SNAKE RUNE!", 3); } if (message.contains("CRAZY RARE DROP! (Scythe Blade)")) { zombieRNG = true; lc.zombieScythes++; lc.zombieScythesSession++; cf.writeIntConfig("zombie", "scythe", lc.zombieScythes); + if (tc.rngesusAlerts) Utils.createTitle(EnumChatFormatting.GOLD + "SCYTHE BLADE!", 5); } if (wolfRNG) { @@ -1044,6 +1058,10 @@ public class TheMod new TextRenderer(Minecraft.getMinecraft(), dropsText, moc.displayXY[0], moc.displayXY[1], ScaleCommand.displayScale); new TextRenderer(Minecraft.getMinecraft(), countText, (int) (moc.displayXY[0] + (110 * ScaleCommand.displayScale)), moc.displayXY[1], ScaleCommand.displayScale); } + + if (showTitle) { + Utils.drawTitle(titleText); + } } @SubscribeEvent(priority = EventPriority.HIGHEST) @@ -1110,6 +1128,16 @@ public class TheMod } } + @SubscribeEvent + public void onTick(TickEvent.ClientTickEvent event) { + if (titleTimer >= 0) { + if (titleTimer == 0) { + showTitle = false; + } + titleTimer--; + } + } + public void increaseEmpSC() { LootCommand lc = new LootCommand(); ConfigHandler cf = new ConfigHandler(); diff --git a/me/Danker/commands/ToggleCommand.java b/me/Danker/commands/ToggleCommand.java index 793dc40..decf99a 100644 --- a/me/Danker/commands/ToggleCommand.java +++ b/me/Danker/commands/ToggleCommand.java @@ -17,6 +17,7 @@ public class ToggleCommand extends CommandBase implements ICommand { public static boolean coordsToggled; public static boolean goldenToggled; public static boolean slayerCountTotal; + public static boolean rngesusAlerts; @Override public String getCommandName() { @@ -25,7 +26,7 @@ public class ToggleCommand extends CommandBase implements ICommand { @Override public String getCommandUsage(ICommandSender arg0) { - return getCommandName() + " <gparty/coords/golden/slayercount/list>"; + return getCommandName() + " <gparty/coords/golden/slayercount/rngesusalerts/list>"; } @Override @@ -36,7 +37,7 @@ public class ToggleCommand extends CommandBase implements ICommand { @Override public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) { if (args.length == 1) { - return getListOfStringsMatchingLastWord(args, "gparty", "coords", "golden", "slayercount", "list"); + return getListOfStringsMatchingLastWord(args, "gparty", "coords", "golden", "slayercount", "rngesusalerts", "list"); } return null; } @@ -47,7 +48,7 @@ public class ToggleCommand extends CommandBase implements ICommand { final ConfigHandler cf = new ConfigHandler(); if (arg1.length == 0) { - player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /toggle <gparty/coords/golden/slayercount/list>")); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /toggle <gparty/coords/golden/slayercount/rngesusalerts/list>")); return; } @@ -66,13 +67,17 @@ public class ToggleCommand extends CommandBase implements ICommand { } else if (arg1[0].equalsIgnoreCase("slayercount")) { slayerCountTotal = !slayerCountTotal; player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Counting total 20% slayer drops has been set to " + EnumChatFormatting.DARK_GREEN + slayerCountTotal + EnumChatFormatting.GREEN + ".")); + } else if (arg1[0].equalsIgnoreCase("rngesusalerts")) { + rngesusAlerts = !rngesusAlerts; + player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Slayer RNGesus alerts has been set to " + EnumChatFormatting.DARK_GREEN + rngesusAlerts + EnumChatFormatting.GREEN + ".")); } else if (arg1[0].equalsIgnoreCase("list")) { player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Guild party notifications: " + EnumChatFormatting.DARK_GREEN + gpartyToggled + "\n" + EnumChatFormatting.GREEN + " Coord/Angle display: " + EnumChatFormatting.DARK_GREEN + coordsToggled + "\n" + EnumChatFormatting.GREEN + " Golden T6 enchants: " + EnumChatFormatting.DARK_GREEN + goldenToggled + "\n" + - EnumChatFormatting.GREEN + " Counting total 20% slayer drops: " + EnumChatFormatting.DARK_GREEN + slayerCountTotal)); + EnumChatFormatting.GREEN + " Counting total 20% slayer drops: " + EnumChatFormatting.DARK_GREEN + slayerCountTotal + "\n" + + EnumChatFormatting.GREEN + " Slayer RNGesus alerts: " + EnumChatFormatting.DARK_GREEN + rngesusAlerts)); } else { - player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /toggle <gparty/coords/golden/slayercount/list>")); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /toggle <gparty/coords/golden/slayercount/rngesusalerts/list>")); } } } diff --git a/me/Danker/handlers/ConfigHandler.java b/me/Danker/handlers/ConfigHandler.java index e2ede5c..4fc4be5 100644 --- a/me/Danker/handlers/ConfigHandler.java +++ b/me/Danker/handlers/ConfigHandler.java @@ -173,6 +173,7 @@ public class ConfigHandler { if (!hasKey("toggles", "Coords")) writeBooleanConfig("toggles", "Coords", false); if (!hasKey("toggles", "Golden")) writeBooleanConfig("toggles", "Golden", false); if (!hasKey("toggles", "SlayerCount")) writeBooleanConfig("toggles", "SlayerCount", true); + if (!hasKey("toggles", "RNGesusAlerts")) writeBooleanConfig("toggles", "RNGesusAlerts", true); if (!hasKey("api", "APIKey")) writeStringConfig("api", "APIKey", ""); // Wolf Loot @@ -259,6 +260,7 @@ public class ConfigHandler { tf.coordsToggled = getBoolean("toggles", "Coords"); tf.goldenToggled = getBoolean("toggles", "Golden"); tf.slayerCountTotal = getBoolean("toggles", "SlayerCount"); + tf.rngesusAlerts = getBoolean("toggles", "RNGesusAlerts"); final LootCommand lc = new LootCommand(); // Wolf diff --git a/me/Danker/utils/Utils.java b/me/Danker/utils/Utils.java index 409e0b6..4749305 100644 --- a/me/Danker/utils/Utils.java +++ b/me/Danker/utils/Utils.java @@ -5,10 +5,13 @@ import java.util.List; import java.util.regex.Matcher; import me.Danker.TheMod; +import me.Danker.handlers.TextRenderer; import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.ScaledResolution; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.ChatComponentText; import net.minecraft.util.StringUtils; public class Utils { @@ -57,4 +60,29 @@ public class Utils { return matchingPlayers; } + public static void createTitle(String text, int seconds) { + Minecraft.getMinecraft().thePlayer.playSound("random.orb", 1, (float) 0.5); + TheMod.titleTimer = seconds * 20; + TheMod.showTitle = true; + TheMod.titleText = text; + } + + public static void drawTitle(String text) { + Minecraft mc = Minecraft.getMinecraft(); + ScaledResolution scaledResolution = new ScaledResolution(mc); + + int height = scaledResolution.getScaledHeight(); + int width = scaledResolution.getScaledWidth(); + int textLength = mc.fontRendererObj.getStringWidth(text); + + double scale = 4; + if (textLength * scale > (width * 0.9F)) { + scale = (width * 0.9F) / (float) textLength; + } + + int titleX = (int) ((width / 2) - (textLength * scale / 2)); + int titleY = (int) ((height * 0.45) / scale); + new TextRenderer(mc, text, titleX, titleY, scale); + } + } |