name icon colors
This commit is contained in:
+1
-1
@@ -8,7 +8,7 @@ org.gradle.jvmargs=-Xmx1G
|
|||||||
loader_version=0.16.10
|
loader_version=0.16.10
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version = 0.0.1-alpha0
|
mod_version = 0.0.1-alpha1
|
||||||
maven_group = me.iipho3nix
|
maven_group = me.iipho3nix
|
||||||
archives_base_name = saturnclient
|
archives_base_name = saturnclient
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import net.minecraft.client.render.entity.state.EntityRenderState;
|
|||||||
import net.minecraft.client.render.entity.state.PlayerEntityRenderState;
|
import net.minecraft.client.render.entity.state.PlayerEntityRenderState;
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
|
import net.minecraft.util.Formatting;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
|
|
||||||
import org.saturnclient.saturnclient.SaturnClientConfig;
|
import org.saturnclient.saturnclient.SaturnClientConfig;
|
||||||
@@ -35,7 +36,7 @@ public abstract class NameTagMixin<S extends EntityRenderState> {
|
|||||||
private void onRenderLabelIfPresent(S state, Text text, MatrixStack matrices,
|
private void onRenderLabelIfPresent(S state, Text text, MatrixStack matrices,
|
||||||
VertexConsumerProvider vertexConsumers, int light, CallbackInfo ci) {
|
VertexConsumerProvider vertexConsumers, int light, CallbackInfo ci) {
|
||||||
if (isSaturn(state)) {
|
if (isSaturn(state)) {
|
||||||
renderLabel(state, Text.literal(SaturnClientConfig.getSaturnIndicator()).append(text), matrices,
|
renderLabel(state, Text.literal(SaturnClientConfig.getSaturnIndicator()).formatted(getIconColor(state)).append(text.copy().withColor(-1)), matrices,
|
||||||
vertexConsumers, light);
|
vertexConsumers, light);
|
||||||
ci.cancel();
|
ci.cancel();
|
||||||
}
|
}
|
||||||
@@ -50,6 +51,29 @@ public abstract class NameTagMixin<S extends EntityRenderState> {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Gets the icon color of a specific individual, here are the different colors
|
||||||
|
*
|
||||||
|
* - Owner: Dark Red
|
||||||
|
* - Admin: Red
|
||||||
|
* - Partners: Gold
|
||||||
|
* - Contributor: Aqua
|
||||||
|
* - Other/player: White
|
||||||
|
*/
|
||||||
|
private Formatting getIconColor(S state) {
|
||||||
|
if (state instanceof PlayerEntityRenderState) {
|
||||||
|
PlayerEntityRenderState playerState = ((PlayerEntityRenderState) state);
|
||||||
|
|
||||||
|
if (playerState.name == "HexLeo") {
|
||||||
|
return Formatting.DARK_RED; // Owner
|
||||||
|
} else {
|
||||||
|
return Formatting.WHITE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return Formatting.WHITE;
|
||||||
|
}
|
||||||
|
|
||||||
private void renderLabel(S state, Text text, MatrixStack matrices,
|
private void renderLabel(S state, Text text, MatrixStack matrices,
|
||||||
VertexConsumerProvider vertexConsumers, int light) {
|
VertexConsumerProvider vertexConsumers, int light) {
|
||||||
Vec3d vec3d = state.nameLabelPos;
|
Vec3d vec3d = state.nameLabelPos;
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ package org.saturnclient.saturnclient.mixin;
|
|||||||
|
|
||||||
import net.minecraft.client.network.PlayerListEntry;
|
import net.minecraft.client.network.PlayerListEntry;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
|
import net.minecraft.util.Formatting;
|
||||||
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.saturnclient.saturnclient.SaturnClientConfig;
|
import org.saturnclient.saturnclient.SaturnClientConfig;
|
||||||
import org.saturnclient.saturnclient.auth.Auth;
|
import org.saturnclient.saturnclient.auth.Auth;
|
||||||
@@ -29,7 +31,23 @@ public abstract class TabListMixin {
|
|||||||
String name = profile.getName();
|
String name = profile.getName();
|
||||||
String uuid = profile.getId().toString().replaceAll("-", "");
|
String uuid = profile.getId().toString().replaceAll("-", "");
|
||||||
|
|
||||||
return Text.literal(
|
return Auth.players.containsKey(uuid) ? Text.literal(SaturnClientConfig.getSaturnIndicator()).formatted(getIconColor(name)).append(Text.literal(name).withColor(-1)) : Text.literal(name);
|
||||||
Auth.players.containsKey(uuid) ? SaturnClientConfig.getSaturnIndicator() + name : name);
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Gets the icon color of a specific individual, here are the different colors
|
||||||
|
*
|
||||||
|
* - Owner: Dark Red
|
||||||
|
* - Admin: Red
|
||||||
|
* - Partners: Gold
|
||||||
|
* - Contributor: Aqua
|
||||||
|
* - Other/player: White
|
||||||
|
*/
|
||||||
|
private Formatting getIconColor(String name) {
|
||||||
|
if (name == "HexLeo") {
|
||||||
|
return Formatting.DARK_RED; // Owner
|
||||||
|
} else {
|
||||||
|
return Formatting.WHITE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user