aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/de/hysky
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/de/hysky')
-rw-r--r--src/main/java/de/hysky/skyblocker/skyblock/dwarven/CommissionLabels.java9
-rw-r--r--src/main/java/de/hysky/skyblocker/skyblock/dwarven/MiningLocationLabel.java17
2 files changed, 10 insertions, 16 deletions
diff --git a/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CommissionLabels.java b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CommissionLabels.java
index 3d7c2c00..b4f9eb22 100644
--- a/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CommissionLabels.java
+++ b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CommissionLabels.java
@@ -5,6 +5,7 @@ import de.hysky.skyblocker.config.configs.MiningConfig;
import de.hysky.skyblocker.utils.Utils;
import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderContext;
import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderEvents;
+import net.minecraft.text.Text;
import net.minecraft.util.math.BlockPos;
import java.util.*;
@@ -47,14 +48,14 @@ public class CommissionLabels {
if (commission.contains(glaciteLocation.getKey())) {
MiningLocationLabel.GlaciteCategory category = glaciteLocation.getValue();
for (BlockPos gemstoneLocation : category.getLocations()) {
- activeWaypoints.add(new MiningLocationLabel(category, gemstoneLocation));
+ activeWaypoints.add(new MiningLocationLabel(category, gemstoneLocation.toCenterPos()));
}
}
}
}
//add base waypoint if enabled
if (SkyblockerConfigManager.get().mining.commissionWaypoints.showBaseCamp) {
- activeWaypoints.add(new MiningLocationLabel(MiningLocationLabel.GlaciteCategory.CAMPFIRE, MiningLocationLabel.GlaciteCategory.CAMPFIRE.getLocations()[0]));
+ activeWaypoints.add(new MiningLocationLabel(MiningLocationLabel.GlaciteCategory.CAMPFIRE, MiningLocationLabel.GlaciteCategory.CAMPFIRE.getLocations()[0].toCenterPos()));
}
return;
}
@@ -68,14 +69,14 @@ public class CommissionLabels {
if (commission.contains(dwarvenLocation.getKey())) {
MiningLocationLabel.DwarvenCategory category = dwarvenLocation.getValue();
category.isTitanium = commission.contains("Titanium");
- activeWaypoints.add(new MiningLocationLabel(category, category.getLocation()));
+ activeWaypoints.add(new MiningLocationLabel(category, category.getLocation().toCenterPos()));
}
}
}
//if there is a commission completed and enabled show emissary
if (SkyblockerConfigManager.get().mining.commissionWaypoints.showEmissary && completed) {
for (MiningLocationLabel.DwarvenEmissaries emissaries : DWARVEN_EMISSARIES) {
- activeWaypoints.add(new MiningLocationLabel(emissaries, emissaries.getLocation()));
+ activeWaypoints.add(new MiningLocationLabel(emissaries, emissaries.getLocation().toCenterPos()));
}
}
}
diff --git a/src/main/java/de/hysky/skyblocker/skyblock/dwarven/MiningLocationLabel.java b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/MiningLocationLabel.java
index 7d565386..45462400 100644
--- a/src/main/java/de/hysky/skyblocker/skyblock/dwarven/MiningLocationLabel.java
+++ b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/MiningLocationLabel.java
@@ -9,20 +9,13 @@ import net.minecraft.util.Formatting;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
-public class MiningLocationLabel {
- final Text name;
- final Category category;
- private final Vec3d centerPos;
+public record MiningLocationLabel (Category category, Vec3d centerPos){
- MiningLocationLabel(Category category, BlockPos pos) {
+ private Text getName() {
if (SkyblockerConfigManager.get().mining.commissionWaypoints.useColor) {
- this.name = Text.literal(category.getName()).withColor(category.getColor());
- } else {
- this.name = Text.literal(category.getName());
+ return Text.literal(category.getName()).withColor(category.getColor());
}
-
- this.category = category;
- this.centerPos = pos.toCenterPos();
+ return Text.literal(category.getName());
}
/**
@@ -33,7 +26,7 @@ public class MiningLocationLabel {
Vec3d posUp = centerPos.add(0, 1, 0);
double distance = context.camera().getPos().distanceTo(centerPos);
float scale = (float) (SkyblockerConfigManager.get().mining.commissionWaypoints.textScale * (distance / 10));
- RenderHelper.renderText(context, name, posUp, scale, true);
+ RenderHelper.renderText(context, getName(), posUp, scale, true);
RenderHelper.renderText(context, Text.literal(Math.round(distance) + "m").formatted(Formatting.YELLOW), posUp, scale, MinecraftClient.getInstance().textRenderer.fontHeight + 1, true);
}