diff options
Diffstat (limited to 'me/Danker')
-rw-r--r-- | me/Danker/TheMod.java | 63 | ||||
-rw-r--r-- | me/Danker/commands/DisplayCommand.java | 7 | ||||
-rw-r--r-- | me/Danker/commands/GetkeyCommand.java | 5 | ||||
-rw-r--r-- | me/Danker/commands/LootCommand.java | 4 | ||||
-rw-r--r-- | me/Danker/commands/MoveCommand.java | 58 | ||||
-rw-r--r-- | me/Danker/commands/SetkeyCommand.java | 5 | ||||
-rw-r--r-- | me/Danker/commands/ToggleCommand.java | 22 | ||||
-rw-r--r-- | me/Danker/handlers/ConfigHandler.java | 16 |
8 files changed, 123 insertions, 57 deletions
diff --git a/me/Danker/TheMod.java b/me/Danker/TheMod.java index 3e9791b..6a4fc5c 100644 --- a/me/Danker/TheMod.java +++ b/me/Danker/TheMod.java @@ -9,6 +9,7 @@ import java.util.List; import me.Danker.commands.DisplayCommand; import me.Danker.commands.GetkeyCommand; import me.Danker.commands.LootCommand; +import me.Danker.commands.MoveCommand; import me.Danker.commands.ReloadConfigCommand; import me.Danker.commands.SetkeyCommand; import me.Danker.commands.ToggleCommand; @@ -20,7 +21,6 @@ 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.EnumChatFormatting; import net.minecraft.util.StringUtils; import net.minecraftforge.client.ClientCommandHandler; @@ -33,13 +33,14 @@ import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; 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; @Mod(modid = TheMod.MODID, version = TheMod.VERSION, clientSideOnly = true) public class TheMod { public static final String MODID = "Danker's Skyblock Mod"; - public static final String VERSION = "1.4"; + public static final String VERSION = "1.4.1"; static int checkItemsNow = 0; static int itemsChecked = 0; @@ -62,16 +63,17 @@ public class TheMod ClientCommandHandler.instance.registerCommand(new LootCommand()); ClientCommandHandler.instance.registerCommand(new ReloadConfigCommand()); ClientCommandHandler.instance.registerCommand(new DisplayCommand()); + ClientCommandHandler.instance.registerCommand(new MoveCommand()); } - @SubscribeEvent - public void onChat(final ClientChatReceivedEvent event) { + // It randomly broke, so I had to make it the highest priority + @SubscribeEvent(priority = EventPriority.HIGHEST) + public void onChat(ClientChatReceivedEvent event) { final ToggleCommand tc = new ToggleCommand(); - final boolean isGPartyToggled = tc.getToggle("gparty"); String message = event.message.getUnformattedText(); if (!message.contains(":")) { - if (isGPartyToggled) { + if (tc.gpartyToggled) { if (message.contains(" has invited all members of ")) { System.out.println(message); try { @@ -112,11 +114,15 @@ public class TheMod } } } - + // Wolf if (message.contains("Talk to Maddox to claim your Wolf Slayer XP!")) { lc.wolfSvens++; + if (lc.wolfBosses != -1) { + lc.wolfBosses++; + } cf.writeIntConfig("wolf", "svens", lc.wolfSvens); + cf.writeIntConfig("wolf", "bossRNG", lc.wolfBosses); } if (message.contains("VERY RARE DROP! (◆ Spirit Rune ")) { lc.wolfSpirits++; @@ -147,7 +153,11 @@ public class TheMod // Spider if (message.contains("Talk to Maddox to claim your Spider Slayer XP!")) { lc.spiderTarantulas++; + if (lc.spiderBosses != -1) { + lc.spiderBosses++; + } cf.writeIntConfig("spider", "tarantulas", lc.spiderTarantulas); + cf.writeIntConfig("spider", "bossRNG", lc.spiderBosses); } if (message.contains("VERY RARE DROP! (◆ Bite Rune")) { @@ -182,7 +192,11 @@ public class TheMod // Zombie if (message.contains("Talk to Maddox to claim your Zombie Slayer XP!")) { lc.zombieRevs++; + if (lc.zombieBosses != -1) { + lc.zombieBosses++; + } cf.writeIntConfig("zombie", "revs", lc.zombieRevs); + cf.writeIntConfig("wolf", "bossRNG", lc.zombieBosses); } // I couldn't find a pic of someone getting this drop, so I'm assuming this works if (message.contains("VERY RARE DROP! (Revenant Catalyst)")) { @@ -221,33 +235,18 @@ public class TheMod lc.wolfBosses = 0; cf.writeIntConfig("wolf", "timeRNG", lc.wolfTime); cf.writeIntConfig("wolf", "bossRNG", 0); - } else { - if (lc.wolfBosses != -1) { - lc.wolfBosses++; - } - cf.writeIntConfig("wolf", "bossRNG", lc.wolfBosses); } if (spiderRNG) { lc.spiderTime = (int) System.currentTimeMillis() / 1000; lc.spiderBosses = 0; cf.writeIntConfig("spider", "timeRNG", lc.spiderTime); cf.writeIntConfig("spider", "bossRNG", 0); - } else { - if (lc.spiderBosses != -1) { - lc.spiderBosses++; - } - cf.writeIntConfig("spider", "bossRNG", lc.spiderBosses); } if (zombieRNG) { lc.zombieTime = (int) System.currentTimeMillis() / 1000; lc.zombieBosses = 0; cf.writeIntConfig("zombie", "timeRNG", lc.zombieTime); cf.writeIntConfig("zombie", "bossRNG", 0); - } else { - if (lc.zombieBosses != -1) { - lc.zombieBosses++; - } - cf.writeIntConfig("wolf", "bossRNG", lc.zombieBosses); } } } @@ -256,10 +255,9 @@ public class TheMod public void renderPlayerInfo(final RenderGameOverlayEvent.Post event) { if (event.type != RenderGameOverlayEvent.ElementType.EXPERIENCE) return; final ToggleCommand tc = new ToggleCommand(); - final boolean isCoordsToggled = tc.getToggle("coords"); + final MoveCommand moc = new MoveCommand(); - if (isCoordsToggled) { - ScaledResolution scaled = new ScaledResolution(Minecraft.getMinecraft()); + if (tc.coordsToggled) { EntityPlayer player = Minecraft.getMinecraft().thePlayer; double xDir = (player.rotationYaw % 360 + 360) % 360; @@ -268,8 +266,7 @@ public class TheMod double yDir = (double) Math.round(player.rotationPitch * 10d) / 10d; String coordText = (int) player.posX + " / " + (int) player.posY + " / " + (int) player.posZ + " (" + xDir + " / " + yDir + ")"; - int height = scaled.getScaledHeight(); - new TextRenderer(Minecraft.getMinecraft(), coordText, 5, height - 25, Integer.parseInt("FFFFFF", 16)); + new TextRenderer(Minecraft.getMinecraft(), coordText, moc.coordsXY[0], moc.coordsXY[1], Integer.parseInt("FFFFFF", 16)); } final DisplayCommand ds = new DisplayCommand(); @@ -378,17 +375,17 @@ public class TheMod EnumChatFormatting.AQUA + timeBetween + "\n" + EnumChatFormatting.AQUA + bossesBetween + "\n"; } - new TextRenderer(Minecraft.getMinecraft(), dropsText, 80, 5, Integer.parseInt("FFFFFF", 16)); - new TextRenderer(Minecraft.getMinecraft(), countText, 190, 5, Integer.parseInt("FFFFFF", 16)); + new TextRenderer(Minecraft.getMinecraft(), dropsText, moc.displayXY[0], moc.displayXY[1], Integer.parseInt("FFFFFF", 16)); + new TextRenderer(Minecraft.getMinecraft(), countText, moc.displayXY[0] + 110, moc.displayXY[1], Integer.parseInt("FFFFFF", 16)); } } - @SubscribeEvent + @SubscribeEvent(priority = EventPriority.HIGHEST) public void onSound(final PlaySoundEvent event) { if (event.name.equals("note.pling")) { - // Don't check twice within 5 seconds + // Don't check twice within 3 seconds checkItemsNow = (int) System.currentTimeMillis() / 1000; - if (checkItemsNow - itemsChecked <= 5) return; + if (checkItemsNow - itemsChecked < 3) return; final ScoreboardHandler sc = new ScoreboardHandler(); List<String> scoreboard = sc.getSidebarLines(); @@ -401,7 +398,7 @@ public class TheMod itemsChecked = (int) System.currentTimeMillis() / 1000; - lc.wolfTeeth += getItems("Wolf Teeth"); + lc.wolfTeeth += getItems("Wolf Tooth"); lc.wolfWheels += getItems("Hamster Wheel"); lc.spiderWebs += getItems("Tarantula Web"); lc.spiderTAP += getItems("Toxic Arrow Poison"); diff --git a/me/Danker/commands/DisplayCommand.java b/me/Danker/commands/DisplayCommand.java index 534ce16..09d7c0f 100644 --- a/me/Danker/commands/DisplayCommand.java +++ b/me/Danker/commands/DisplayCommand.java @@ -6,6 +6,7 @@ import net.minecraft.command.CommandException; import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ChatComponentText; +import net.minecraft.util.EnumChatFormatting; public class DisplayCommand extends CommandBase { public static String display; @@ -30,7 +31,7 @@ public class DisplayCommand extends CommandBase { final EntityPlayer player = (EntityPlayer) arg0; if (arg1.length == 0) { - player.addChatMessage(new ChatComponentText("Usage: /display [zombie/spider/wolf/off]")); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /display [zombie/spider/wolf/off]")); return; } @@ -45,10 +46,10 @@ public class DisplayCommand extends CommandBase { } else if (arg1[0].equalsIgnoreCase("off")) { display = "off"; } else { - player.addChatMessage(new ChatComponentText("Usage: /display [zombie/spider/wolf/off]")); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /display [zombie/spider/wolf/off]")); return; } - player.addChatMessage(new ChatComponentText("Display set to " + display + ".")); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Display set to " + EnumChatFormatting.DARK_GREEN + display + EnumChatFormatting.GREEN + ".")); cf.writeStringConfig("misc", "display", display); } diff --git a/me/Danker/commands/GetkeyCommand.java b/me/Danker/commands/GetkeyCommand.java index e8b29e6..80354fe 100644 --- a/me/Danker/commands/GetkeyCommand.java +++ b/me/Danker/commands/GetkeyCommand.java @@ -7,6 +7,7 @@ import net.minecraft.command.ICommand; import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ChatComponentText; +import net.minecraft.util.EnumChatFormatting; public class GetkeyCommand extends CommandBase implements ICommand { @@ -31,9 +32,9 @@ public class GetkeyCommand extends CommandBase implements ICommand { final ConfigHandler cf = new ConfigHandler(); if (cf.getString("api", "APIKey").equals("")) { - player.addChatMessage(new ChatComponentText("API key not set. Set your API key using /setkey.")); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "API key not set. Set your API key using /setkey.")); } else { - player.addChatMessage(new ChatComponentText("Your set API key is " + cf.getString("api", "APIKey"))); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Your set API key is " + EnumChatFormatting.DARK_GREEN + cf.getString("api", "APIKey"))); } } diff --git a/me/Danker/commands/LootCommand.java b/me/Danker/commands/LootCommand.java index 4b05d25..11382b3 100644 --- a/me/Danker/commands/LootCommand.java +++ b/me/Danker/commands/LootCommand.java @@ -97,7 +97,7 @@ public class LootCommand extends CommandBase { final EntityPlayer player = (EntityPlayer) arg0; if (arg1.length == 0) { - player.addChatMessage(new ChatComponentText("Usage: /loot [zombie/spider/wolf]")); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /loot [zombie/spider/wolf]")); return; } @@ -184,7 +184,7 @@ public class LootCommand extends CommandBase { EnumChatFormatting.AQUA + " Bosses Since RNG: " + bossesBetween + "\n" + EnumChatFormatting.GREEN + "" + EnumChatFormatting.BOLD + " -------------------")); } else { - player.addChatMessage(new ChatComponentText("Usage: /loot [zombie/spider/wolf]")); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /loot [zombie/spider/wolf]")); } } diff --git a/me/Danker/commands/MoveCommand.java b/me/Danker/commands/MoveCommand.java new file mode 100644 index 0000000..d402680 --- /dev/null +++ b/me/Danker/commands/MoveCommand.java @@ -0,0 +1,58 @@ +package me.Danker.commands; + +import me.Danker.handlers.ConfigHandler; +import net.minecraft.command.CommandBase; +import net.minecraft.command.CommandException; +import net.minecraft.command.ICommandSender; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.EnumChatFormatting; + +public class MoveCommand extends CommandBase { + + public static int[] coordsXY = {0, 0}; + public static int[] displayXY = {0, 0}; + + @Override + public String getCommandName() { + return "move"; + } + + @Override + public String getCommandUsage(ICommandSender arg0) { + return getCommandName() + " [coords/display] [x] [y]"; + } + + @Override + public int getRequiredPermissionLevel() { + return 0; + } + + @Override + public void processCommand(ICommandSender arg0, String[] arg1) throws CommandException { + final EntityPlayer player = (EntityPlayer)arg0; + final ConfigHandler cf = new ConfigHandler(); + + if (arg1.length < 2) { + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /move [coords/display] [x] [y]")); + return; + } + + if (arg1[0].equalsIgnoreCase("coords")) { + coordsXY[0] = Integer.parseInt(arg1[1]); + coordsXY[1] = Integer.parseInt(arg1[2]); + cf.writeIntConfig("locations", "coordsX", coordsXY[0]); + cf.writeIntConfig("locations", "coordsY", coordsXY[1]); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Coords have been moved to " + EnumChatFormatting.DARK_GREEN + arg1[1] + ", " + arg1[2])); + } else if (arg1[0].equalsIgnoreCase("display")) { + displayXY[0] = Integer.parseInt(arg1[1]); + displayXY[1] = Integer.parseInt(arg1[2]); + cf.writeIntConfig("locations", "displayX", displayXY[0]); + cf.writeIntConfig("locations", "displayY", displayXY[1]); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Tracker display has been moved to " + EnumChatFormatting.DARK_GREEN + arg1[1] + ", " + arg1[2])); + } else { + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /move [coords/display] [x] [y]")); + } + } + +} diff --git a/me/Danker/commands/SetkeyCommand.java b/me/Danker/commands/SetkeyCommand.java index 85e9dd7..14f2336 100644 --- a/me/Danker/commands/SetkeyCommand.java +++ b/me/Danker/commands/SetkeyCommand.java @@ -7,6 +7,7 @@ import net.minecraft.command.ICommand; import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ChatComponentText; +import net.minecraft.util.EnumChatFormatting; public class SetkeyCommand extends CommandBase implements ICommand { @@ -30,13 +31,13 @@ public class SetkeyCommand extends CommandBase implements ICommand { final EntityPlayer player = (EntityPlayer)arg0; if (arg1.length == 0) { - player.addChatMessage(new ChatComponentText("Usage: /setkey [key]")); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /setkey [key]")); return; } final ConfigHandler cf = new ConfigHandler(); cf.writeStringConfig("api", "APIKey", arg1[0]); - player.addChatMessage(new ChatComponentText("Set API key to " + arg1[0])); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Set API key to " + EnumChatFormatting.DARK_GREEN + arg1[0])); } } diff --git a/me/Danker/commands/ToggleCommand.java b/me/Danker/commands/ToggleCommand.java index 7e1b83a..bbcafc1 100644 --- a/me/Danker/commands/ToggleCommand.java +++ b/me/Danker/commands/ToggleCommand.java @@ -7,19 +7,11 @@ import net.minecraft.command.ICommand; import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ChatComponentText; +import net.minecraft.util.EnumChatFormatting; public class ToggleCommand extends CommandBase implements ICommand { public static boolean gpartyToggled; public static boolean coordsToggled; - - public boolean getToggle(String type) { - if (type.equals("gparty")) { - return gpartyToggled; - } else if (type.equals("coords")) { - return coordsToggled; - } - return true; - } @Override public String getCommandName() { @@ -42,23 +34,23 @@ public class ToggleCommand extends CommandBase implements ICommand { final ConfigHandler cf = new ConfigHandler(); if (arg1.length == 0) { - player.addChatMessage(new ChatComponentText("Usage: /toggle [gparty/coords/list]")); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /toggle [gparty/coords/list]")); return; } if (arg1[0].equalsIgnoreCase("gparty")) { gpartyToggled = !gpartyToggled; cf.writeBooleanConfig("toggles", "GParty", gpartyToggled); - player.addChatMessage(new ChatComponentText("Guild party notifications has been set to " + gpartyToggled + ".")); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Guild party notifications has been set to " + EnumChatFormatting.DARK_GREEN + gpartyToggled + EnumChatFormatting.GREEN + ".")); } else if (arg1[0].equalsIgnoreCase("coords")) { coordsToggled = !coordsToggled; cf.writeBooleanConfig("toggles", "Coords", coordsToggled); - player.addChatMessage(new ChatComponentText("Coord/Angle display has been set to " + coordsToggled + ".")); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Coord/Angle display has been set to " + EnumChatFormatting.DARK_GREEN + coordsToggled + EnumChatFormatting.GREEN + ".")); } else if (arg1[0].equalsIgnoreCase("list")) { - player.addChatMessage(new ChatComponentText("Guild party notifications: " + gpartyToggled)); - player.addChatMessage(new ChatComponentText("Coord/Angle display: " + coordsToggled)); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Guild party notifications: " + EnumChatFormatting.DARK_GREEN + gpartyToggled + "\n" + + EnumChatFormatting.GREEN + " Coord/Angle display: " + EnumChatFormatting.DARK_GREEN + coordsToggled)); } else { - player.addChatMessage(new ChatComponentText("Usage: /toggle [gparty/coords/list]")); + player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /toggle [gparty/coords/list]")); } } } diff --git a/me/Danker/handlers/ConfigHandler.java b/me/Danker/handlers/ConfigHandler.java index c9556f1..64ada11 100644 --- a/me/Danker/handlers/ConfigHandler.java +++ b/me/Danker/handlers/ConfigHandler.java @@ -4,7 +4,10 @@ import java.io.File; import me.Danker.commands.DisplayCommand; import me.Danker.commands.LootCommand; +import me.Danker.commands.MoveCommand; import me.Danker.commands.ToggleCommand; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.ScaledResolution; import net.minecraftforge.common.config.Configuration; public class ConfigHandler { @@ -166,6 +169,13 @@ public class ConfigHandler { if (!hasKey("misc", "display")) writeStringConfig("misc", "display", "off"); + ScaledResolution scaled = new ScaledResolution(Minecraft.getMinecraft()); + int height = scaled.getScaledHeight(); + if (!hasKey("locations", "coordsX")) writeIntConfig("locations", "coordsX", 5); + if (!hasKey("locations", "coordsY")) writeIntConfig("locations", "coordsY", height - 25); + if (!hasKey("locations", "displayX")) writeIntConfig("locations", "displayX", 80); + if (!hasKey("locations", "displayY")) writeIntConfig("locations", "displayY", 5); + final ToggleCommand tf = new ToggleCommand(); tf.gpartyToggled = getBoolean("toggles", "GParty"); tf.coordsToggled = getBoolean("toggles", "Coords"); @@ -211,6 +221,12 @@ public class ConfigHandler { final DisplayCommand ds = new DisplayCommand(); ds.display = getString("misc", "display"); + + final MoveCommand moc = new MoveCommand(); + moc.coordsXY[0] = getInt("locations", "coordsX"); + moc.coordsXY[1] = getInt("locations", "coordsY"); + moc.displayXY[0] = getInt("locations", "displayX"); + moc.displayXY[1] = getInt("locations", "displayY"); } } |