aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java3
-rw-r--r--src/main/java/de/hysky/skyblocker/config/categories/DwarvenMinesCategory.java10
-rw-r--r--src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsHud.java25
-rw-r--r--src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsLocationsManager.java5
-rw-r--r--src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsWaypoint.java20
-rw-r--r--src/main/resources/assets/skyblocker/lang/en_us.json1
6 files changed, 31 insertions, 33 deletions
diff --git a/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java b/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java
index e84d2d85..ecf66407 100644
--- a/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java
+++ b/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java
@@ -917,6 +917,9 @@ public class SkyblockerConfig {
public boolean showLocations = true;
@SerialEntry
+ public int locationSize = 8;
+
+ @SerialEntry
public int x = 10;
@SerialEntry
diff --git a/src/main/java/de/hysky/skyblocker/config/categories/DwarvenMinesCategory.java b/src/main/java/de/hysky/skyblocker/config/categories/DwarvenMinesCategory.java
index 0dc48368..a15424a7 100644
--- a/src/main/java/de/hysky/skyblocker/config/categories/DwarvenMinesCategory.java
+++ b/src/main/java/de/hysky/skyblocker/config/categories/DwarvenMinesCategory.java
@@ -9,6 +9,7 @@ import dev.isxander.yacl3.api.Option;
import dev.isxander.yacl3.api.OptionDescription;
import dev.isxander.yacl3.api.OptionGroup;
import de.hysky.skyblocker.skyblock.dwarven.DwarvenHudConfigScreen;
+import dev.isxander.yacl3.api.controller.IntegerSliderControllerBuilder;
import net.minecraft.client.MinecraftClient;
import net.minecraft.text.Text;
@@ -82,7 +83,7 @@ public class DwarvenMinesCategory {
.controller(ConfigUtils::createBooleanController)
.build())
.build())
- //crystal HUD
+ //crystal HUD //todo add descriptions to features
.group(OptionGroup.createBuilder()
.name(Text.translatable("text.autoconfig.skyblocker.option.locations.dwarvenMines.crystalsHud"))
.collapsed(false)
@@ -105,6 +106,13 @@ public class DwarvenMinesCategory {
newValue -> config.locations.dwarvenMines.crystalsHud.showLocations = newValue)
.controller(ConfigUtils::createBooleanController)
.build())
+ .option(Option.<Integer>createBuilder()
+ .name(Text.translatable("text.autoconfig.skyblocker.option.locations.dwarvenMines.crystalsHud.locationSize"))
+ .binding(defaults.locations.dwarvenMines.crystalsHud.locationSize,
+ () -> config.locations.dwarvenMines.crystalsHud.locationSize,
+ newValue -> config.locations.dwarvenMines.crystalsHud.locationSize = newValue)
+ .controller(opt -> IntegerSliderControllerBuilder.create(opt).range(4, 12).step(2))
+ .build())
.build())
//crystals waypoints
.group(OptionGroup.createBuilder()
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 01b1e9ec..e9dfd6ac 100644
--- a/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsHud.java
+++ b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsHud.java
@@ -11,9 +11,7 @@ import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallba
import net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.DrawContext;
-import net.minecraft.client.texture.atlas.Sprite;
import net.minecraft.util.Identifier;
-import org.apache.commons.math3.analysis.UnivariateMatrixFunction;
import java.awt.*;
import java.util.Arrays;
@@ -22,13 +20,16 @@ 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"); //todo is this the right place to store file
+ protected 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");
- public static boolean visable = false;
+ private static final String[] SMALL_LOCATIONS = new String[] {"Fairy Grotto","King","Corleone"};
+
+ public static boolean visible = false;
+
+
- public static final int LOCATION_SIZE = 10; //todo possible config option
@@ -42,7 +43,7 @@ public class CrystalsHud {
if (!SkyblockerConfigManager.get().locations.dwarvenMines.crystalsHud.enabled
|| client.options.playerListKey.isPressed()
|| client.player == null
- || !visable) {
+ || !visible) {
return;
}
render(context, SkyblockerConfigManager.get().locations.dwarvenMines.crystalsHud.x,
@@ -64,8 +65,12 @@ public class CrystalsHud {
for (CrystalsWaypoint waypoint : ActiveWaypoints.values()){
Color waypointColor = waypoint.category.color;
Pair<Integer, Integer> renderPos = transformLocation(waypoint.pos.getX(),waypoint.pos.getZ());
- //fill square of size LOCATION_SIZE around the coordinates of the location
- context.fill(hudX+renderPos.first()-LOCATION_SIZE/2,hudY+renderPos.second()-LOCATION_SIZE/2,hudX+renderPos.first()+LOCATION_SIZE/2,hudY+renderPos.second()+LOCATION_SIZE/2,waypointColor.getRGB());
+ 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;
+ }
+ //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());
}
}
//draw player on map
@@ -96,11 +101,11 @@ public class CrystalsHud {
public static void update() {
if (client.player == null || client.getNetworkHandler() == null || !SkyblockerConfigManager.get().locations.dwarvenMines.crystalsHud.enabled) {
- visable = false;
+ visible = false;
return;
}
//get if the player is in the crystals
- visable = Utils.isInCrystals();
+ visible = Utils.isInCrystals();
}
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 ed9ba8bf..181a8750 100644
--- a/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsLocationsManager.java
+++ b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsLocationsManager.java
@@ -25,6 +25,7 @@ import net.minecraft.server.command.ServerCommandSource;
import net.minecraft.text.ClickEvent;
import net.minecraft.text.MutableText;
import net.minecraft.text.Text;
+import net.minecraft.util.Util;
import net.minecraft.util.math.BlockPos;
import java.awt.*;
@@ -164,8 +165,8 @@ public class CrystalsLocationsManager {
}
public static void update() {
- if (client.player == null || client.getNetworkHandler() == null || !SkyblockerConfigManager.get().locations.dwarvenMines.crystalsWaypoints.enabled) {
- SkyblockerConfigManager.get().locations.dwarvenMines.crystalsWaypoints.ActiveWaypoints= new HashMap<>(); //todo dose not seem to be working
+ if (client.player == null || client.getNetworkHandler() == null || !SkyblockerConfigManager.get().locations.dwarvenMines.crystalsWaypoints.enabled || !Utils.isInCrystals()) {
+ SkyblockerConfigManager.get().locations.dwarvenMines.crystalsWaypoints.ActiveWaypoints= new HashMap<>();
return;
}
//get if the player is in the crystals
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 5445a68c..09eeb419 100644
--- a/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsWaypoint.java
+++ b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsWaypoint.java
@@ -31,13 +31,6 @@ import java.util.function.ToDoubleFunction;
public class CrystalsWaypoint extends Waypoint {
private static final Logger LOGGER = LoggerFactory.getLogger(CrystalsWaypoint.class);
- public static final Codec<CrystalsWaypoint> CODEC = RecordCodecBuilder.create(instance -> instance.group(
- Category.CODEC.fieldOf("category").forGetter(crystalsWaypoint -> crystalsWaypoint.category),
- TextCodecs.CODEC.fieldOf("name").forGetter(crystalsWaypoint -> crystalsWaypoint.name),
- BlockPos.CODEC.fieldOf("pos").forGetter(crystalsWaypoint -> crystalsWaypoint.pos)
- ).apply(instance, CrystalsWaypoint::new));
-
-
private static final Supplier<SkyblockerConfig.CrystalsWaypoints> CONFIG = () -> SkyblockerConfigManager.get().locations.dwarvenMines.crystalsWaypoints;
static final Supplier<Type> TYPE_SUPPLIER = () -> CONFIG.get().waypointType;
@@ -137,18 +130,5 @@ public class CrystalsWaypoint extends Waypoint {
return name;
}
- static class CategoryArgumentType extends EnumArgumentType<Category> {
- CategoryArgumentType() {
- super(Category.CODEC, Category::values);
- }
-
- static CategoryArgumentType category() {
- return new CategoryArgumentType();
- }
-
- static <S> Category getCategory(CommandContext<S> context, String name) {
- return context.getArgument(name, Category.class);
- }
- }
}
}
diff --git a/src/main/resources/assets/skyblocker/lang/en_us.json b/src/main/resources/assets/skyblocker/lang/en_us.json
index 4269441d..b994ab63 100644
--- a/src/main/resources/assets/skyblocker/lang/en_us.json
+++ b/src/main/resources/assets/skyblocker/lang/en_us.json
@@ -280,6 +280,7 @@
"text.autoconfig.skyblocker.option.locations.dwarvenMines.crystalsHud.enabled": "Enabled",
"text.autoconfig.skyblocker.option.locations.dwarvenMines.crystalsHud.screen": "Crystals HUD Config...",
"text.autoconfig.skyblocker.option.locations.dwarvenMines.crystalsHud.showLocations": "Show Waypoints",
+ "text.autoconfig.skyblocker.option.locations.dwarvenMines.crystalsHud.showLocations.locationSize": "Location Size",
"text.autoconfig.skyblocker.option.locations.dwarvenMines.crystalsWaypoints": "Crystal Hollows Waypoints",
"text.autoconfig.skyblocker.option.locations.dwarvenMines.crystalsWaypoints.enabled": "Enabled Waypoints",
"text.autoconfig.skyblocker.option.locations.dwarvenMines.crystalsWaypoints.findInChat": "Find Waypoints In Chat",