Skip to content

Commit

Permalink
Bracket labels and make them yellow
Browse files Browse the repository at this point in the history
  • Loading branch information
xpple committed Jan 10, 2025
1 parent cd3bba8 commit ad9efd2
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import net.earthcomputer.clientcommands.render.RenderQueue;
import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource;
import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderContext;
import net.minecraft.ChatFormatting;
import net.minecraft.SharedConstants;
import net.minecraft.Util;
import net.minecraft.client.Camera;
Expand All @@ -32,6 +33,7 @@
import net.minecraft.nbt.NbtUtils;
import net.minecraft.nbt.Tag;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.ComponentUtils;
import net.minecraft.resources.ResourceKey;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.level.Level;
Expand Down Expand Up @@ -286,7 +288,7 @@ public static void renderWaypointLabels(GuiGraphics guiGraphics, DeltaTracker de

double distanceSquared = waypoint.location().distToCenterSqr(cameraEntity.position());
long distance = Math.round(Math.sqrt(distanceSquared));
String label = waypointName + ' ' + distance;
Component label = ComponentUtils.wrapInSquareBrackets(Component.literal(waypointName + ' ' + distance).withStyle(ChatFormatting.YELLOW));

Vector2d waypointLocation = new Vector2d(waypoint.location().getX(), waypoint.location().getZ());
double angleRad = viewVector.angle(waypointLocation.sub(position, new Vector2d()));
Expand Down Expand Up @@ -393,6 +395,6 @@ public static void renderWaypointBoxes(WorldRenderContext context) {
record WaypointLocation(ResourceKey<Level> dimension, BlockPos location) {
}

record WaypointLabelLocation(String label, int location) {
record WaypointLabelLocation(Component label, int location) {
}
}

0 comments on commit ad9efd2

Please sign in to comment.