aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/thatgravyboat/skyblockhud/handlers
diff options
context:
space:
mode:
authorThatGravyBoat <thatgravyboat@gmail.com>2021-07-13 01:51:19 -0230
committerThatGravyBoat <thatgravyboat@gmail.com>2021-07-13 01:51:19 -0230
commit3bd212839e1d3c497a840221a0c149451967467e (patch)
tree9a306491b76808a17a26c6bef6f74c08cbc99964 /src/main/java/com/thatgravyboat/skyblockhud/handlers
parent087d97fb0663edc5e343187c0fa4ec1bc6b081bc (diff)
downloadSkyblockHud-Death-Defied-3bd212839e1d3c497a840221a0c149451967467e.tar.gz
SkyblockHud-Death-Defied-3bd212839e1d3c497a840221a0c149451967467e.tar.bz2
SkyblockHud-Death-Defied-3bd212839e1d3c497a840221a0c149451967467e.zip
Added 2 new subcommands to crystal waypoints, Added medals shown in farmhouse, Added config option to stop auto flipping of rpg hud, Added option so if exp bar is still being rendered it should hide when holding drill to not overlay them and keep a consistent hud
Diffstat (limited to 'src/main/java/com/thatgravyboat/skyblockhud/handlers')
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/handlers/CrystalWaypoints.java72
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/handlers/MapHandler.java8
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/handlers/SlayerHandler.java16
3 files changed, 64 insertions, 32 deletions
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/handlers/CrystalWaypoints.java b/src/main/java/com/thatgravyboat/skyblockhud/handlers/CrystalWaypoints.java
index 079e108..0932ab1 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/handlers/CrystalWaypoints.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/handlers/CrystalWaypoints.java
@@ -1,14 +1,21 @@
package com.thatgravyboat.skyblockhud.handlers;
import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
+import com.thatgravyboat.skyblockhud.SkyblockHud;
import com.thatgravyboat.skyblockhud.Utils;
import com.thatgravyboat.skyblockhud.api.events.LocationChangeEvent;
import com.thatgravyboat.skyblockhud.commands.SimpleCommand;
import com.thatgravyboat.skyblockhud.location.LocationCategory;
import com.thatgravyboat.skyblockhud.location.LocationHandler;
+import com.thatgravyboat.skyblockhud.location.Locations;
+import java.awt.*;
+import java.awt.datatransfer.StringSelection;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
+import java.util.Set;
+import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.command.ICommandSender;
import net.minecraft.util.BlockPos;
@@ -21,15 +28,13 @@ public class CrystalWaypoints {
public static final HashMap<String, BlockPos> waypoints = new HashMap<>();
+ private static final Set<Locations> IMPORTANT_WAYPOINTS = Sets.newHashSet(Locations.GOBLINQUEENSDEN, Locations.LOSTPRECURSORCITY, Locations.JUNGLETEMPLE, Locations.MINESOFDIVAN);
+
@SubscribeEvent
public void onRenderLast(RenderWorldLastEvent event) {
- waypoints.forEach(
- (text, pos) -> {
- GlStateManager.disableCull();
- GlStateManager.disableDepth();
- Utils.renderWaypointText(text, pos, event.partialTicks);
- }
- );
+ GlStateManager.disableCull();
+ GlStateManager.disableDepth();
+ waypoints.forEach((text, pos) -> Utils.renderWaypointText(text, pos, event.partialTicks));
GlStateManager.enableCull();
GlStateManager.enableDepth();
}
@@ -39,6 +44,14 @@ public class CrystalWaypoints {
if (!event.newLocation.getCategory().equals(LocationCategory.CRYSTALHOLLOWS)) {
waypoints.clear();
}
+ else if (!waypoints.containsKey("Crystal Nucleus") && SkyblockHud.config.mining.autoWaypoint){
+ waypoints.put("Crystal Nucleus", new BlockPos(512.5,106.5,512.5));
+ }
+ if (IMPORTANT_WAYPOINTS.contains(event.newLocation) && SkyblockHud.config.mining.autoWaypoint){
+ if (!waypoints.containsKey(event.newLocation.getDisplayName())){
+ waypoints.put(event.newLocation.getDisplayName(), Minecraft.getMinecraft().thePlayer.getPosition());
+ }
+ }
}
public static class WaypointCommand extends SimpleCommand {
@@ -49,15 +62,18 @@ public class CrystalWaypoints {
new ProcessCommandRunnable() {
@Override
public void processCommand(ICommandSender sender, String[] args) {
+ if (args.length == 0) return;
String subCommand = args[0].toLowerCase();
String name = String.join(" ", Arrays.copyOfRange(args, 1, args.length));
switch (subCommand) {
case "add":
if (LocationHandler.getCurrentLocation().getCategory().equals(LocationCategory.CRYSTALHOLLOWS)) {
- if (!CrystalWaypoints.waypoints.containsKey(name)) {
+ if (!CrystalWaypoints.waypoints.containsKey(name) && name.length() > 1) {
CrystalWaypoints.waypoints.put(name, sender.getPosition().add(0.5, 0.5, 0.5));
+ } else if (name.length() < 2) {
+ sbhMessage(sender, "Waypoint name needs to be longer than 1");
} else {
- sender.addChatMessage(new ChatComponentText("[" + EnumChatFormatting.RED + EnumChatFormatting.BOLD + "SkyBlockHud" + EnumChatFormatting.RESET + "] : " + EnumChatFormatting.GRAY + "Waypoint already exists!"));
+ sbhMessage(sender, "Waypoint already exists!");
}
}
break;
@@ -66,29 +82,61 @@ public class CrystalWaypoints {
if (CrystalWaypoints.waypoints.containsKey(name)) {
CrystalWaypoints.waypoints.remove(name);
} else {
- sender.addChatMessage(new ChatComponentText("[" + EnumChatFormatting.RED + EnumChatFormatting.BOLD + "SkyBlockHud" + EnumChatFormatting.RESET + "] : " + EnumChatFormatting.GRAY + "Waypoint doesnt exist!"));
+ sbhMessage(sender, "Waypoint doesnt exist!");
}
}
break;
case "clear":
CrystalWaypoints.waypoints.clear();
break;
+ case "addat":
+ if (LocationHandler.getCurrentLocation().getCategory().equals(LocationCategory.CRYSTALHOLLOWS)) {
+ name = String.join(" ", Arrays.copyOfRange(args, 4, args.length));
+ try {
+ if (!CrystalWaypoints.waypoints.containsKey(name)) {
+ CrystalWaypoints.waypoints.put(name, parseBlockPos(sender, args, 1, true));
+ } else if (name.length() < 2) {
+ sbhMessage(sender, "Waypoint name needs to be longer than 1");
+ } else {
+ sbhMessage(sender, "Waypoint already exists!");
+ }
+ }catch (Exception e){
+ sbhMessage(sender, "Error!");
+ }
+ }
+ break;
+ case "copy":
+ BlockPos pos = waypoints.get(name);
+ if (pos == null) {
+ sbhMessage(sender, "No waypoint with that name!");
+ break;
+ }
+ StringSelection clipboard = new StringSelection(name + " : ("+pos.getX()+"/"+pos.getY()+"/"+pos.getZ()+")");
+ Toolkit.getDefaultToolkit().getSystemClipboard().setContents(clipboard, clipboard);
+ break;
}
}
},
new TabCompleteRunnable() {
@Override
public List<String> tabComplete(ICommandSender sender, String[] args, BlockPos pos) {
- if (args.length == 2 && args[0].equalsIgnoreCase("remove")) {
+ if (args.length == 2 && (args[0].equalsIgnoreCase("remove") || args[0].equalsIgnoreCase("copy"))) {
return getListOfStringsMatchingLastWord(args, waypoints.keySet());
}
if (args.length == 1) {
- return getListOfStringsMatchingLastWord(args, Lists.newArrayList("add", "clear", "remove"));
+ return getListOfStringsMatchingLastWord(args, Lists.newArrayList("add", "clear", "remove", "copy", "addat"));
+ }
+ if (args.length > 1 && args[0].equalsIgnoreCase("addat")){
+ return func_175771_a(args, 1, pos);
}
return null;
}
}
);
}
+
+ private static void sbhMessage(ICommandSender sender, String message){
+ sender.addChatMessage(new ChatComponentText("[" + EnumChatFormatting.RED + EnumChatFormatting.BOLD + "SkyBlockHud" + EnumChatFormatting.RESET + "] : " + EnumChatFormatting.GRAY + message));
+ }
}
}
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/handlers/MapHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/handlers/MapHandler.java
index 64cc7dc..e7143a9 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/handlers/MapHandler.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/handlers/MapHandler.java
@@ -1,7 +1,5 @@
package com.thatgravyboat.skyblockhud.handlers;
-import static com.thatgravyboat.skyblockhud.GuiTextures.mapOverlay;
-
import com.thatgravyboat.skyblockhud.SkyblockHud;
import com.thatgravyboat.skyblockhud.Utils;
import com.thatgravyboat.skyblockhud.config.KeyBindings;
@@ -26,6 +24,8 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;
import org.lwjgl.opengl.GL11;
+import static com.thatgravyboat.skyblockhud.GuiTextures.mapOverlay;
+
public class MapHandler {
public enum MapIconTypes {
@@ -126,10 +126,10 @@ public class MapHandler {
mc.renderEngine.bindTexture(mapOverlay);
Gui.drawModalRectWithCustomSizedTexture(pos.getAbsX(event.resolution, 72), pos.getAbsY(event.resolution, 72), 0, 0, 72, 72, 256, 256);
String keyCode = GameSettings.getKeyDisplayString(KeyBindings.map.getKeyCode());
- Utils.drawStringCenteredScaled(keyCode, mc.fontRendererObj, pos.getAbsX(event.resolution, 64) + 58, pos.getAbsY(event.resolution, 72) + 66, false, 6, 0xFFFFFF);
+ Utils.drawStringCenteredScaled(keyCode, mc.fontRendererObj, pos.getAbsX(event.resolution, 64) + (pos.rightAligned(event.resolution, 72) ? 50 : 58), pos.getAbsY(event.resolution, 72) + 66, false, 6, 0xFFFFFF);
BlockPos playerPos = mc.thePlayer.getPosition();
String position = String.format("%d/%d/%d", playerPos.getX(), playerPos.getY(), playerPos.getZ());
- Utils.drawStringCenteredScaled(position, mc.fontRendererObj, pos.getAbsX(event.resolution, 64) + 29, pos.getAbsY(event.resolution, 72) + 66, false, 36, 0xFFFFFF);
+ Utils.drawStringCenteredScaled(position, mc.fontRendererObj, pos.getAbsX(event.resolution, 64) + (pos.rightAligned(event.resolution, 72) ? 21 : 29), pos.getAbsY(event.resolution, 72) + 66, false, 36, 0xFFFFFF);
GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f);
}
}
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/handlers/SlayerHandler.java b/src/main/java/com/thatgravyboat/skyblockhud/handlers/SlayerHandler.java
index 67bde54..49b2928 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/handlers/SlayerHandler.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/handlers/SlayerHandler.java
@@ -11,8 +11,6 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
public class SlayerHandler {
- //Optional Characters are required because Hypixel dumb and cuts off text
- private static final Pattern COMBAT_XP_REGEX = Pattern.compile("\\(([\\d,]+)/([\\dkm]+)\\) comb?a?t? x?p?");
private static final Pattern KILLS_REGEX = Pattern.compile("(\\d+)/(\\d+) kills?");
public enum slayerTypes {
@@ -91,7 +89,6 @@ public class SlayerHandler {
if (isDoingSlayer) {
String line = event.formattedLine.toLowerCase();
Matcher killMatcher = KILLS_REGEX.matcher(line);
- Matcher xpMatcher = COMBAT_XP_REGEX.matcher(line);
if (killMatcher.find()) {
SlayerHandler.bossSlain = false;
@@ -102,15 +99,6 @@ public class SlayerHandler {
try {
maxKills = Integer.parseInt(killMatcher.group(2));
} catch (Exception ignored) {}
- } else if (xpMatcher.find()) {
- SlayerHandler.bossSlain = false;
- SlayerHandler.isKillingBoss = false;
- try {
- progress = Integer.parseInt(xpMatcher.group(1));
- } catch (Exception ignored) {}
- try {
- maxKills = Integer.parseInt(xpMatcher.group(2).replace("k", "")) * (xpMatcher.group(2).contains("k") ? 1000 : xpMatcher.group(2).contains("m") ? 1000000 : 1);
- } catch (Exception ignored) {}
} else if (line.contains("slay the boss")) {
SlayerHandler.bossSlain = false;
SlayerHandler.isKillingBoss = true;
@@ -122,10 +110,6 @@ public class SlayerHandler {
SlayerHandler.progress = 0;
SlayerHandler.bossSlain = true;
}
- if (maxKills == 0 && progress == 0) {
- SlayerHandler.maxKills = 0;
- SlayerHandler.progress = 0;
- }
}
}
}