aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/de/hysky/skyblocker
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/de/hysky/skyblocker')
-rw-r--r--src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java2
-rw-r--r--src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsHud.java70
-rw-r--r--src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsHudConfigScreen.java1
-rw-r--r--src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsLocationsManager.java129
-rw-r--r--src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsWaypoint.java23
-rw-r--r--src/main/java/de/hysky/skyblocker/skyblock/dwarven/DwarvenHud.java11
-rw-r--r--src/main/java/de/hysky/skyblocker/skyblock/dwarven/DwarvenHudConfigScreen.java2
-rw-r--r--src/main/java/de/hysky/skyblocker/skyblock/tabhud/widget/hud/HudPowderWidget.java7
-rw-r--r--src/main/java/de/hysky/skyblocker/utils/Utils.java8
9 files changed, 138 insertions, 115 deletions
diff --git a/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java b/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java
index 775c70ce..5ca9604c 100644
--- a/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java
+++ b/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java
@@ -909,6 +909,7 @@ public class SkyblockerConfig {
@SerialEntry
public int powderY = 70;
}
+
public static class CrystalsHud {
@SerialEntry
public boolean enabled = true;
@@ -925,6 +926,7 @@ public class SkyblockerConfig {
@SerialEntry
public int y = 130;
}
+
public static class CrystalsWaypoints {
@SerialEntry
public boolean enabled = true;
diff --git a/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsHud.java b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsHud.java
index 0c3d40eb..171f13ea 100644
--- a/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsHud.java
+++ b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsHud.java
@@ -19,17 +19,13 @@ import java.util.Arrays;
import java.util.Map;
public class CrystalsHud {
- public static final MinecraftClient client = MinecraftClient.getInstance();
-
- protected static final Identifier MAP_TEXTURE = new Identifier(SkyblockerMod.NAMESPACE, "textures/gui/crystals_map.png");
-
+ private static final MinecraftClient CLIENT = MinecraftClient.getInstance();
+ private static final Identifier MAP_TEXTURE = new Identifier(SkyblockerMod.NAMESPACE, "textures/gui/crystals_map.png");
private static final Identifier MAP_ICON = new Identifier("textures/map/map_icons.png");
-
- private static final String[] SMALL_LOCATIONS = new String[] {"Fairy Grotto","King","Corleone"};
+ private static final String[] SMALL_LOCATIONS = { "Fairy Grotto", "King", "Corleone" };
public static boolean visible = false;
-
public static void init() {
ClientCommandRegistrationCallback.EVENT.register((dispatcher, registryAccess) -> dispatcher.register(ClientCommandManager.literal("skyblocker")
.then(ClientCommandManager.literal("hud")
@@ -38,8 +34,7 @@ public class CrystalsHud {
HudRenderCallback.EVENT.register((context, tickDelta) -> {
if (!SkyblockerConfigManager.get().locations.dwarvenMines.crystalsHud.enabled
- || client.options.playerListKey.isPressed()
- || client.player == null
+ || CLIENT.player == null
|| !visible) {
return;
}
@@ -48,7 +43,7 @@ public class CrystalsHud {
});
}
- public static IntIntPair getDimForConfig() {
+ protected static IntIntPair getDimForConfig() {
return IntIntPair.of(62, 62);
}
@@ -60,40 +55,43 @@ public class CrystalsHud {
* @param hudX Top left X coordinate of the map
* @param hudY Top left Y coordinate of the map
*/
- public static void render( DrawContext context, int hudX, int hudY) {
+ protected static void render(DrawContext context, int hudX, int hudY) {
//draw map texture
- context.
- drawTexture(MAP_TEXTURE,hudX,hudY,0,0,62,62,62,62);
+ context.drawTexture(MAP_TEXTURE, hudX, hudY, 0, 0, 62, 62, 62, 62);
+
//if enabled add waypoint locations to map
- if (SkyblockerConfigManager.get().locations.dwarvenMines.crystalsHud.showLocations){
+ if (SkyblockerConfigManager.get().locations.dwarvenMines.crystalsHud.showLocations) {
Map<String,CrystalsWaypoint> ActiveWaypoints= CrystalsLocationsManager.activeWaypoints;
- for (CrystalsWaypoint waypoint : ActiveWaypoints.values()){
+
+ for (CrystalsWaypoint waypoint : ActiveWaypoints.values()) {
Color waypointColor = waypoint.category.color;
Pair<Integer, Integer> renderPos = transformLocation(waypoint.pos.getX(),waypoint.pos.getZ());
int locationSize = SkyblockerConfigManager.get().locations.dwarvenMines.crystalsHud.locationSize;
- if (Arrays.asList(SMALL_LOCATIONS).contains(waypoint.name.getString())){//if small location half the location size
- locationSize = locationSize/2;
+
+ if (Arrays.asList(SMALL_LOCATIONS).contains(waypoint.name.getString())) {//if small location half the location size
+ locationSize = locationSize / 2;
}
+
//fill square of size locationSize around the coordinates of the location
- context.fill(hudX+renderPos.first()-locationSize/2,hudY+renderPos.second()-locationSize/2,hudX+renderPos.first()+locationSize/2,hudY+renderPos.second()+locationSize/2,waypointColor.getRGB());
+ context.fill(hudX + renderPos.first() - locationSize / 2, hudY + renderPos.second() - locationSize / 2, hudX + renderPos.first() + locationSize / 2, hudY + renderPos.second() + locationSize / 2, waypointColor.getRGB());
}
}
+
//draw player on map
- if (client.player == null || client.getNetworkHandler() == null) {
+ if (CLIENT.player == null || CLIENT.getNetworkHandler() == null) {
return;
}
+
//get player location
- double playerX = client.player.getX();
- double playerZ = client.player.getZ();
- double facing = client.player.getYaw();
+ double playerX = CLIENT.player.getX();
+ double playerZ = CLIENT.player.getZ();
Pair<Integer, Integer> renderPos = transformLocation(playerX,playerZ);
//draw marker on map
- context.
- drawTexture(MAP_ICON,hudX+renderPos.first()-2,hudY+renderPos.second()-2,58,2,4,4,128,128);
+ context.drawTexture(MAP_ICON, hudX + renderPos.first() - 2, hudY + renderPos.second() - 2, 58, 2, 4, 4, 128, 128);
//todo add direction and scale (can not work out how to rotate)
-
}
+
/**
* Converts an X and Z coordinate in the crystal hollow to a X and Y coordinate on the map.
*
@@ -101,27 +99,27 @@ public class CrystalsHud {
* @param z the world Z coordinate
* @return the pair of values for x and y
*/
- protected static Pair<Integer, Integer> transformLocation(double x, double z){
+ protected static Pair<Integer, Integer> transformLocation(double x, double z) {
//converts an x and z to a location on the map
- int transformedX = (int)((x-202)/621 * 62);
- int transformedY = (int)((z -202)/621 * 62);
- transformedX = MathHelper.clamp(transformedX,0, 62);
- transformedY = MathHelper.clamp(transformedY,0, 62);
- return Pair.of(transformedX,transformedY);
+ int transformedX = (int)((x - 202) / 621 * 62);
+ int transformedY = (int)((z - 202) / 621 * 62);
+ transformedX = MathHelper.clamp(transformedX, 0, 62);
+ transformedY = MathHelper.clamp(transformedY, 0, 62);
+
+ return Pair.of(transformedX,transformedY);
}
+
/**
* Works out if the crystals map should be rendered and sets {@link CrystalsHud#visible} accordingly.
*
*/
public static void update() {
- if (client.player == null || client.getNetworkHandler() == null || !SkyblockerConfigManager.get().locations.dwarvenMines.crystalsHud.enabled) {
+ if (CLIENT.player == null || CLIENT.getNetworkHandler() == null || !SkyblockerConfigManager.get().locations.dwarvenMines.crystalsHud.enabled) {
visible = false;
return;
}
- //get if the player is in the crystals
- visible = Utils.isInCrystals();
-
+ //get if the player is in the crystals
+ visible = Utils.isInCrystalHollows();
}
-
}
diff --git a/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsHudConfigScreen.java b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsHudConfigScreen.java
index 18be8bed..e30d6390 100644
--- a/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsHudConfigScreen.java
+++ b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsHudConfigScreen.java
@@ -1,7 +1,6 @@
package de.hysky.skyblocker.skyblock.dwarven;
import de.hysky.skyblocker.config.SkyblockerConfigManager;
-import de.hysky.skyblocker.skyblock.tabhud.widget.hud.HudCommsWidget;
import de.hysky.skyblocker.utils.render.RenderHelper;
import it.unimi.dsi.fastutil.ints.IntIntPair;
import net.minecraft.client.gui.DrawContext;
diff --git a/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsLocationsManager.java b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsLocationsManager.java
index 8101fae6..5b196f8e 100644
--- a/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsLocationsManager.java
+++ b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsLocationsManager.java
@@ -3,12 +3,16 @@ package de.hysky.skyblocker.skyblock.dwarven;
import com.mojang.brigadier.Command;
import com.mojang.brigadier.CommandDispatcher;
import com.mojang.brigadier.arguments.StringArgumentType;
+import com.mojang.logging.LogUtils;
+
import de.hysky.skyblocker.SkyblockerMod;
import de.hysky.skyblocker.config.SkyblockerConfigManager;
+import de.hysky.skyblocker.utils.Constants;
import de.hysky.skyblocker.utils.Utils;
import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback;
import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource;
import net.fabricmc.fabric.api.client.message.v1.ClientReceiveMessageEvents;
+import net.fabricmc.fabric.api.client.networking.v1.ClientPlayConnectionEvents;
import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderContext;
import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderEvents;
import net.minecraft.client.MinecraftClient;
@@ -28,19 +32,22 @@ import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import org.slf4j.Logger;
+
import static com.mojang.brigadier.arguments.StringArgumentType.getString;
import static net.fabricmc.fabric.api.client.command.v2.ClientCommandManager.argument;
import static net.fabricmc.fabric.api.client.command.v2.ClientCommandManager.literal;
public class CrystalsLocationsManager {
- public static final MinecraftClient client = MinecraftClient.getInstance();
+ private static final Logger LOGGER = LogUtils.getLogger();
+ private static final MinecraftClient CLIENT = MinecraftClient.getInstance();
/**
* A look-up table to convert between location names and waypoint in the {@link CrystalsWaypoint.Category} values.
*/
- public static final Map<String, CrystalsWaypoint.Category> WAYPOINTLOCATIONS = Map.of(
+ protected static final Map<String, CrystalsWaypoint.Category> WAYPOINT_LOCATIONS = Map.of(
"Jungle Temple", CrystalsWaypoint.Category.JUNGLE_TEMPLE,
- "Mines Of Divan", CrystalsWaypoint.Category.MINES_OF_DIVAN,
+ "Mines of Divan", CrystalsWaypoint.Category.MINES_OF_DIVAN,
"Goblin Queen's Den", CrystalsWaypoint.Category.GOBLIN_QUEENS_DEN,
"Lost Precursor City", CrystalsWaypoint.Category.LOST_PRECURSOR_CITY,
"Khazad-dûm", CrystalsWaypoint.Category.KHAZADUM,
@@ -49,53 +56,64 @@ public class CrystalsLocationsManager {
"Corleone", CrystalsWaypoint.Category.CORLEONE,
"King", CrystalsWaypoint.Category.KING
);
- protected static Map<String, CrystalsWaypoint> activeWaypoints = new HashMap<>() {};
-
private static final Pattern TEXT_CWORDS_PATTERN = Pattern.compile("([0-9][0-9][0-9]) ([0-9][0-9][0-9]?) ([0-9][0-9][0-9])");
+ protected static Map<String, CrystalsWaypoint> activeWaypoints = new HashMap<>();
public static void init() {
WorldRenderEvents.AFTER_TRANSLUCENT.register(CrystalsLocationsManager::render);
ClientReceiveMessageEvents.GAME.register(CrystalsLocationsManager::extractLocationFromMessage);
ClientCommandRegistrationCallback.EVENT.register(CrystalsLocationsManager::registerWaypointLocationCommands);
+ ClientPlayConnectionEvents.JOIN.register((_handler, _sender, _client) -> reset());
}
- private static void extractLocationFromMessage(Text message, Boolean overlay){
- if (!SkyblockerConfigManager.get().locations.dwarvenMines.crystalsWaypoints.findInChat || !Utils.isInCrystals()) {
+
+ private static void extractLocationFromMessage(Text message, Boolean overlay) {
+ if (!SkyblockerConfigManager.get().locations.dwarvenMines.crystalsWaypoints.findInChat || !Utils.isInCrystalHollows()) {
return;
}
- //get the message text
- String value = message.getString();
- Matcher matcher = TEXT_CWORDS_PATTERN.matcher(value);
- //if there are coordinates in the message try to get them and what they are talking about
- if (matcher.find()){
- String location = matcher.group();
- Integer[] coordinates = Arrays.stream(location.split(" ",3)).map(Integer::parseInt).toArray(Integer[]::new);
- BlockPos blockPos = new BlockPos(coordinates[0],coordinates[1],coordinates[2]);
- //if position is not in the hollows do not add it
- if (!checkInCrystals(blockPos)){
- return;
- }
- //see if there is a name of a location to add to this
- for (String waypointLocation : WAYPOINTLOCATIONS.keySet()){
- if (value.toLowerCase().contains(waypointLocation.toLowerCase())){ //todo be more lenient
- //all data found to create waypoint
- addCustomWaypoint(Text.of(waypointLocation),blockPos);
+
+ try {
+ //get the message text
+ String value = message.getString();
+ Matcher matcher = TEXT_CWORDS_PATTERN.matcher(value);
+ //if there are coordinates in the message try to get them and what they are talking about
+ if (matcher.find()) {
+ String location = matcher.group();
+ int[] coordinates = Arrays.stream(location.split(" ", 3)).mapToInt(Integer::parseInt).toArray();
+ BlockPos blockPos = new BlockPos(coordinates[0], coordinates[1], coordinates[2]);
+
+ //if position is not in the hollows do not add it
+ if (!checkInCrystals(blockPos)) {
return;
}
+
+ //see if there is a name of a location to add to this
+ for (String waypointLocation : WAYPOINT_LOCATIONS.keySet()) {
+ if (value.toLowerCase().contains(waypointLocation.toLowerCase())) { //todo be more lenient
+ //all data found to create waypoint
+ addCustomWaypoint(Text.of(waypointLocation),blockPos);
+ return;
+ }
+ }
+
+ //if the location is not found ask the user for the location (could have been in a previous chat message)
+ if (CLIENT.player == null || CLIENT.getNetworkHandler() == null) {
+ return;
+ }
+
+ CLIENT.player.sendMessage(getLocationInputText(location), false);
}
- //if the location is not found ask the user for the location (could have been in a previous chat message)
- if (client.player == null || client.getNetworkHandler() == null ) {
- return;
- }
- client.player.sendMessage(getLocationInputText(location), false);
+ } catch (Exception e) {
+ LOGGER.error("[Skyblocker Crystals Locations Manager] Encountered an exception while extracing a location from a chat message!", e);
}
}
protected static Boolean checkInCrystals(BlockPos pos){
//checks if a location is inside crystal hollows bounds
- return pos.getX() >= 202 && pos.getX() <= 823
+ return pos.getX() >= 202 && pos.getX() <= 823
&& pos.getZ() >= 202 && pos.getZ() <= 823
&& pos.getY() >= 31 && pos.getY() <= 188;
}
+
private static void registerWaypointLocationCommands(CommandDispatcher<FabricClientCommandSource> dispatcher, CommandRegistryAccess registryAccess) {
dispatcher.register(literal(SkyblockerMod.NAMESPACE)
.then(literal("crystalWaypoints")
@@ -107,46 +125,55 @@ public class CrystalsLocationsManager {
)
);
}
+
protected static Text getSetLocationMessage(String location,BlockPos blockPos) {
- MutableText text = Text.empty();
+ MutableText text = Constants.PREFIX.get();
text.append(Text.literal("Added waypoint for "));
- Color locationColor = WAYPOINTLOCATIONS.get(location).color;
+ Color locationColor = WAYPOINT_LOCATIONS.get(location).color;
text.append(Text.literal(location).withColor(locationColor.getRGB()));
- text.append(Text.literal(" at : "+blockPos.getX()+" "+blockPos.getY()+" "+blockPos.getZ()+"."));
+ text.append(Text.literal(" at : " + blockPos.getX() + " " + blockPos.getY() + " " + blockPos.getZ() + "."));
+
return text;
}
+
private static Text getLocationInputText(String location) {
- MutableText text = Text.empty();
- for (String waypointLocation : WAYPOINTLOCATIONS.keySet()){
- Color locationColor = WAYPOINTLOCATIONS.get(waypointLocation).color;
- text.append(Text.literal("["+waypointLocation+"]").withColor(locationColor.getRGB()).styled(style -> style.withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/skyblocker crystalWaypoints "+location+" "+waypointLocation))));
+ MutableText text = Constants.PREFIX.get();
+
+ for (String waypointLocation : WAYPOINT_LOCATIONS.keySet()) {
+ Color locationColor = WAYPOINT_LOCATIONS.get(waypointLocation).color;
+ text.append(Text.literal("[" + waypointLocation + "]").withColor(locationColor.getRGB()).styled(style -> style.withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/skyblocker crystalWaypoints " + location + " " + waypointLocation))));
}
return text;
}
+
public static int addWaypointFromCommand(FabricClientCommandSource source, String place, PosArgument location) {
// TODO Less hacky way with custom ClientBlockPosArgumentType
BlockPos blockPos = location.toAbsoluteBlockPos(new ServerCommandSource(null, source.getPosition(), source.getRotation(), null, 0, null, null, null, null));
- if (WAYPOINTLOCATIONS.containsKey(place)){
+
+ if (WAYPOINT_LOCATIONS.containsKey(place)) {
addCustomWaypoint(Text.of(place), blockPos);
+
//tell the client it has done this
- if (client.player == null || client.getNetworkHandler() == null ) {
+ if (CLIENT.player == null || CLIENT.getNetworkHandler() == null) {
return 0;
}
- client.player.sendMessage(getSetLocationMessage(place, blockPos), false);
+
+ CLIENT.player.sendMessage(getSetLocationMessage(place, blockPos), false);
}
+
return Command.SINGLE_SUCCESS;
}
private static void addCustomWaypoint( Text waypointName, BlockPos pos) {
- CrystalsWaypoint.Category category = WAYPOINTLOCATIONS.get(waypointName.getString());
+ CrystalsWaypoint.Category category = WAYPOINT_LOCATIONS.get(waypointName.getString());
CrystalsWaypoint waypoint = new CrystalsWaypoint(category, waypointName, pos);
activeWaypoints.put(waypointName.getString(),waypoint);
}
public static void render(WorldRenderContext context) {
- if (SkyblockerConfigManager.get().locations.dwarvenMines.crystalsWaypoints.enabled ) {
+ if (SkyblockerConfigManager.get().locations.dwarvenMines.crystalsWaypoints.enabled) {
for (CrystalsWaypoint crystalsWaypoint : activeWaypoints.values()) {
if (crystalsWaypoint.shouldRender()) {
crystalsWaypoint.render(context);
@@ -155,20 +182,22 @@ public class CrystalsLocationsManager {
}
}
+ private static void reset() {
+ activeWaypoints.clear();
+ }
+
public static void update() {
- if (client.player == null || client.getNetworkHandler() == null || !SkyblockerConfigManager.get().locations.dwarvenMines.crystalsWaypoints.enabled || !Utils.isInCrystals()) {
- activeWaypoints = new HashMap<>();
+ if (CLIENT.player == null || CLIENT.getNetworkHandler() == null || !SkyblockerConfigManager.get().locations.dwarvenMines.crystalsWaypoints.enabled || !Utils.isInCrystalHollows()) {
return;
}
+
//get if the player is in the crystals
- String location = Utils.getIslandArea().replace("⏣ ","");
+ String location = Utils.getIslandArea().replace("⏣ ", "");
//if new location and needs waypoint add waypoint
- if (!location.equals("Unknown") && WAYPOINTLOCATIONS.containsKey(location) && !activeWaypoints.containsKey(location)){
+ if (!location.equals("Unknown") && WAYPOINT_LOCATIONS.containsKey(location) && !activeWaypoints.containsKey(location)) {
//add waypoint at player location
- BlockPos playerLocation = client.player.getBlockPos();
- addCustomWaypoint(Text.of(location),playerLocation);
+ BlockPos playerLocation = CLIENT.player.getBlockPos();
+ addCustomWaypoint(Text.of(location), playerLocation);
}
-
-
}
}
diff --git a/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsWaypoint.java b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsWaypoint.java
index f9016f3a..ad85e763 100644
--- a/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsWaypoint.java
+++ b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsWaypoint.java
@@ -27,7 +27,7 @@ public class CrystalsWaypoint extends Waypoint {
private static final Logger LOGGER = LoggerFactory.getLogger(CrystalsWaypoint.class);
private static final Supplier<SkyblockerConfig.Waypoints> CONFIG = () -> SkyblockerConfigManager.get().general.waypoints;
- static final Supplier<Type> TYPE_SUPPLIER = () -> CONFIG.get().waypointType;
+ private static final Supplier<Type> TYPE_SUPPLIER = () -> CONFIG.get().waypointType;
final Category category;
final Text name;
private final Vec3d centerPos;
@@ -52,7 +52,6 @@ public class CrystalsWaypoint extends Waypoint {
return super.shouldRender() ;
}
-
@Override
public boolean equals(Object obj) {
return super.equals(obj) || obj instanceof CrystalsWaypoint other && category == other.category && name.equals(other.name) && pos.equals(other.pos);
@@ -78,16 +77,16 @@ public class CrystalsWaypoint extends Waypoint {
* enum for the different waypoints used int the crystals hud each with a {@link Category#name} and associated {@link Category#color}
*/
enum Category implements StringIdentifiable {
- JUNGLE_TEMPLE("Jungle Temple",Color.GREEN),
- MINES_OF_DIVAN("Mines Of Divan",Color.CYAN),
- GOBLIN_QUEENS_DEN("Goblin Queen's Den",Color.ORANGE),
- LOST_PRECURSOR_CITY("Lost Precursor City",Color.BLUE),
- KHAZADUM("Khazad-dûm",Color.RED),
- FAIRY_GROTTO("Fairy Grotto",Color.PINK),
- DRAGONS_LAIR("Dragon's Lair",Color.BLACK),
- CORLEONE("Corleone",Color.gray),
- KING("King",Color.yellow),
- DEFAULT("Default",Color.BLACK);
+ JUNGLE_TEMPLE("Jungle Temple", Color.GREEN),
+ MINES_OF_DIVAN("Mines of Divan", Color.CYAN),
+ GOBLIN_QUEENS_DEN("Goblin Queen's Den", Color.ORANGE),
+ LOST_PRECURSOR_CITY("Lost Precursor City", Color.BLUE),
+ KHAZADUM("Khazad-dûm", Color.RED),
+ FAIRY_GROTTO("Fairy Grotto", Color.PINK),
+ DRAGONS_LAIR("Dragon's Lair", Color.BLACK),
+ CORLEONE("Corleone", Color.gray),
+ KING("King", Color.yellow),
+ DEFAULT("Default", Color.BLACK);
public final Color color;
diff --git a/src/main/java/de/hysky/skyblocker/skyblock/dwarven/DwarvenHud.java b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/DwarvenHud.java
index 5c3498bc..3eef66d7 100644
--- a/src/main/java/de/hysky/skyblocker/skyblock/dwarven/DwarvenHud.java
+++ b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/DwarvenHud.java
@@ -4,6 +4,7 @@ import de.hysky.skyblocker.config.SkyblockerConfigManager;
import de.hysky.skyblocker.skyblock.tabhud.util.Colors;
import de.hysky.skyblocker.skyblock.tabhud.widget.hud.HudCommsWidget;
import de.hysky.skyblocker.skyblock.tabhud.widget.hud.HudPowderWidget;
+import de.hysky.skyblocker.utils.Utils;
import de.hysky.skyblocker.utils.scheduler.Scheduler;
import it.unimi.dsi.fastutil.Pair;
import it.unimi.dsi.fastutil.ints.IntIntPair;
@@ -15,7 +16,6 @@ import net.minecraft.client.gui.DrawContext;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
-import java.awt.*;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
@@ -61,7 +61,8 @@ public class DwarvenHud {
|| commissionList.isEmpty()) {
return;
}
- render(HudCommsWidget.INSTANCE,HudPowderWidget.INSTANCE, context,
+
+ render(HudCommsWidget.INSTANCE, HudPowderWidget.INSTANCE, context,
SkyblockerConfigManager.get().locations.dwarvenMines.dwarvenHud.x,
SkyblockerConfigManager.get().locations.dwarvenMines.dwarvenHud.y,
SkyblockerConfigManager.get().locations.dwarvenMines.dwarvenHud.powderX,
@@ -201,10 +202,12 @@ public class DwarvenHud {
}
public static void update() {
- commissionList = new ArrayList<>();
- if (client.player == null || client.getNetworkHandler() == null || !SkyblockerConfigManager.get().locations.dwarvenMines.dwarvenHud.enabledCommissions)
+ if (client.player == null || client.getNetworkHandler() == null || !SkyblockerConfigManager.get().locations.dwarvenMines.dwarvenHud.enabledCommissions || (!Utils.isInCrystalHollows()
+ && !Utils.getLocationRaw().equals("mining_3")))
return;
+ commissionList = new ArrayList<>();
+
client.getNetworkHandler().getPlayerList().forEach(playerListEntry -> {
if (playerListEntry.getDisplayName() != null) {
//find commissions
diff --git a/src/main/java/de/hysky/skyblocker/skyblock/dwarven/DwarvenHudConfigScreen.java b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/DwarvenHudConfigScreen.java
index 4214ca89..d5dc19f2 100644
--- a/src/main/java/de/hysky/skyblocker/skyblock/dwarven/DwarvenHudConfigScreen.java
+++ b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/DwarvenHudConfigScreen.java
@@ -37,7 +37,7 @@ public class DwarvenHudConfigScreen extends Screen {
public void render(DrawContext context, int mouseX, int mouseY, float delta) {
super.render(context, mouseX, mouseY, delta);
renderBackground(context, mouseX, mouseY, delta);
- DwarvenHud.render(HudCommsWidget.INSTANCE_CFG, HudPowderWidget.INSTANCE_CFG, context, commissionsHudX, commissionsHudY,powderHudX,powderHudY,CFG_COMMS);
+ DwarvenHud.render(HudCommsWidget.INSTANCE_CFG, HudPowderWidget.INSTANCE_CFG, context, commissionsHudX, commissionsHudY, powderHudX, powderHudY, CFG_COMMS);
context.drawCenteredTextWithShadow(textRenderer, "Right Click To Reset Position", width / 2, height / 2, Color.GRAY.getRGB());
}
diff --git a/src/main/java/de/hysky/skyblocker/skyblock/tabhud/widget/hud/HudPowderWidget.java b/src/main/java/de/hysky/skyblocker/skyblock/tabhud/widget/hud/HudPowderWidget.java
index 345794d8..1d11c2a6 100644
--- a/src/main/java/de/hysky/skyblocker/skyblock/tabhud/widget/hud/HudPowderWidget.java
+++ b/src/main/java/de/hysky/skyblocker/skyblock/tabhud/widget/hud/HudPowderWidget.java
@@ -1,14 +1,7 @@
package de.hysky.skyblocker.skyblock.tabhud.widget.hud;
-import java.util.List;
-
-import de.hysky.skyblocker.skyblock.dwarven.DwarvenHud.Commission;
-import de.hysky.skyblocker.skyblock.tabhud.util.Colors;
import de.hysky.skyblocker.skyblock.tabhud.util.Ico;
import de.hysky.skyblocker.skyblock.tabhud.widget.Widget;
-import de.hysky.skyblocker.skyblock.tabhud.widget.component.Component;
-import de.hysky.skyblocker.skyblock.tabhud.widget.component.PlainTextComponent;
-import de.hysky.skyblocker.skyblock.tabhud.widget.component.ProgressComponent;
import net.minecraft.text.MutableText;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
diff --git a/src/main/java/de/hysky/skyblocker/utils/Utils.java b/src/main/java/de/hysky/skyblocker/utils/Utils.java
index a8a0d3d6..066bc19b 100644
--- a/src/main/java/de/hysky/skyblocker/utils/Utils.java
+++ b/src/main/java/de/hysky/skyblocker/utils/Utils.java
@@ -25,7 +25,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
-import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.CompletableFuture;
@@ -37,7 +36,7 @@ public class Utils {
private static final Logger LOGGER = LoggerFactory.getLogger(Utils.class);
private static final String ALTERNATE_HYPIXEL_ADDRESS = System.getProperty("skyblocker.alternateHypixelAddress", "");
private static final String DUNGEONS_LOCATION = "dungeon";
- public static final String CRYSTALS_LOCATION = "crystal_hollows";
+ private static final String CRYSTAL_HOLLOWS_LOCATION = "crystal_hollows";
private static final String PROFILE_PREFIX = "Profile: ";
private static boolean isOnHypixel = false;
@@ -88,8 +87,9 @@ public class Utils {
public static boolean isInDungeons() {
return getLocationRaw().equals(DUNGEONS_LOCATION) || FabricLoader.getInstance().isDevelopmentEnvironment();
}
- public static boolean isInCrystals(){
- return getLocationRaw().equals(CRYSTALS_LOCATION) || FabricLoader.getInstance().isDevelopmentEnvironment();
+
+ public static boolean isInCrystalHollows() {
+ return getLocationRaw().equals(CRYSTAL_HOLLOWS_LOCATION) || FabricLoader.getInstance().isDevelopmentEnvironment();
}
public static boolean isInTheRift() {