Fixed bugs and restructured roles
This commit is contained in:
@@ -0,0 +1,59 @@
|
|||||||
|
package org.saturnclient.saturnclient.client.player;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import org.saturnclient.saturnclient.config.SaturnClientConfig;
|
||||||
|
|
||||||
|
import net.minecraft.util.Formatting;
|
||||||
|
|
||||||
|
public class Roles {
|
||||||
|
static enum Role {
|
||||||
|
OWNER,
|
||||||
|
ADMIN,
|
||||||
|
PARTNER,
|
||||||
|
CONTRIBUTOR
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final Map<UUID, Role> ROLES = Map.of(
|
||||||
|
UUID.fromString("d362a042-28bd-49e1-a807-ae74dbe8aba9"),
|
||||||
|
Role.OWNER);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
public static Formatting getIconColor(UUID uuid) {
|
||||||
|
Role role = ROLES.get(uuid);
|
||||||
|
|
||||||
|
if (role == null) {
|
||||||
|
return Formatting.WHITE;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (role) {
|
||||||
|
case OWNER:
|
||||||
|
return Formatting.DARK_RED;
|
||||||
|
|
||||||
|
case ADMIN:
|
||||||
|
return Formatting.RED;
|
||||||
|
|
||||||
|
case PARTNER:
|
||||||
|
return Formatting.GOLD;
|
||||||
|
|
||||||
|
case CONTRIBUTOR:
|
||||||
|
return Formatting.AQUA;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return Formatting.WHITE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getSaturnIndicator() {
|
||||||
|
return SaturnClientConfig.realisticLogo.value ? "" : "";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,6 +4,7 @@ import java.util.HashMap;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.saturnclient.saturnclient.client.ServiceClient;
|
import org.saturnclient.saturnclient.client.ServiceClient;
|
||||||
|
|
||||||
public class SaturnPlayer {
|
public class SaturnPlayer {
|
||||||
@@ -22,14 +23,17 @@ public class SaturnPlayer {
|
|||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
public static SaturnPlayer get() {
|
public static SaturnPlayer get() {
|
||||||
return PLAYERS.get(ServiceClient.uuid);
|
return PLAYERS.get(ServiceClient.uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
public static SaturnPlayer get(UUID uuid) {
|
public static SaturnPlayer get(UUID uuid) {
|
||||||
return PLAYERS.get(uuid);
|
return PLAYERS.get(uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
public static SaturnPlayer get(String name) {
|
public static SaturnPlayer get(String name) {
|
||||||
UUID uuid = PLAYER_NAMES.get(name);
|
UUID uuid = PLAYER_NAMES.get(name);
|
||||||
if (uuid == null)
|
if (uuid == null)
|
||||||
|
|||||||
@@ -1,12 +1,8 @@
|
|||||||
package org.saturnclient.saturnclient.config;
|
package org.saturnclient.saturnclient.config;
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import org.lwjgl.glfw.GLFW;
|
import org.lwjgl.glfw.GLFW;
|
||||||
import org.saturnclient.ui2.resources.Textures;
|
import org.saturnclient.ui2.resources.Textures;
|
||||||
|
|
||||||
import net.minecraft.util.Formatting;
|
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
|
|
||||||
public class SaturnClientConfig {
|
public class SaturnClientConfig {
|
||||||
@@ -17,59 +13,10 @@ public class SaturnClientConfig {
|
|||||||
public static Property<Boolean> bendyCloaks = Property.bool(true);
|
public static Property<Boolean> bendyCloaks = Property.bool(true);
|
||||||
public static Property<Integer> openEmoteWheel = Property.keybinding(GLFW.GLFW_KEY_B);
|
public static Property<Integer> openEmoteWheel = Property.keybinding(GLFW.GLFW_KEY_B);
|
||||||
|
|
||||||
static enum Role {
|
|
||||||
OWNER,
|
|
||||||
ADMIN,
|
|
||||||
PARTNER,
|
|
||||||
CONTRIBUTOR
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final Map<UUID, Role> ROLES = Map.of(
|
|
||||||
UUID.fromString("d362a042-28bd-49e1-a807-ae74dbe8aba9"),
|
|
||||||
Role.OWNER);
|
|
||||||
|
|
||||||
public static Identifier getLogo() {
|
public static Identifier getLogo() {
|
||||||
return realisticLogo.value ? Textures.REALISTIC_LOGO : Textures.LOGO;
|
return realisticLogo.value ? Textures.REALISTIC_LOGO : Textures.LOGO;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getSaturnIndicator() {
|
|
||||||
return realisticLogo.value ? "" : "";
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* 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
|
|
||||||
*/
|
|
||||||
public static Formatting getIconColor(UUID uuid) {
|
|
||||||
Role role = ROLES.get(uuid);
|
|
||||||
|
|
||||||
if (role == null) {
|
|
||||||
return Formatting.WHITE;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (role) {
|
|
||||||
case OWNER:
|
|
||||||
return Formatting.DARK_RED;
|
|
||||||
|
|
||||||
case ADMIN:
|
|
||||||
return Formatting.RED;
|
|
||||||
|
|
||||||
case PARTNER:
|
|
||||||
return Formatting.GOLD;
|
|
||||||
|
|
||||||
case CONTRIBUTOR:
|
|
||||||
return Formatting.AQUA;
|
|
||||||
|
|
||||||
default:
|
|
||||||
return Formatting.WHITE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void init() {
|
public static void init() {
|
||||||
config = new ConfigManager("Saturn Client");
|
config = new ConfigManager("Saturn Client");
|
||||||
config.property("Realistic logo", realisticLogo);
|
config.property("Realistic logo", realisticLogo);
|
||||||
|
|||||||
@@ -283,14 +283,16 @@ public class CloakFeatureRenderer extends FeatureRenderer<PlayerEntityRenderStat
|
|||||||
|
|
||||||
public void render(MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int light,
|
public void render(MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int light,
|
||||||
PlayerEntityRenderState playerEntityRenderState, float f, float g) {
|
PlayerEntityRenderState playerEntityRenderState, float f, float g) {
|
||||||
if (playerEntityRenderState.invisible || !playerEntityRenderState.capeVisible) {
|
if (playerEntityRenderState.invisible || !playerEntityRenderState.capeVisible
|
||||||
|
|| playerEntityRenderState.skinTextures.capeTexture() != null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (playerEntityRenderState.skinTextures.capeTexture() != null) {
|
SaturnPlayer player = SaturnPlayer.get(playerEntityRenderState.name);
|
||||||
|
|
||||||
|
if (player == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
SaturnPlayer player = SaturnPlayer.get(playerEntityRenderState.name);
|
|
||||||
|
|
||||||
Identifier customCape = Cloaks.getCurrentCloakTexture(player.uuid);
|
Identifier customCape = Cloaks.getCurrentCloakTexture(player.uuid);
|
||||||
if (customCape == null || this.hasCustomModelForLayer(playerEntityRenderState.equippedChestStack,
|
if (customCape == null || this.hasCustomModelForLayer(playerEntityRenderState.equippedChestStack,
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ import net.minecraft.text.Text;
|
|||||||
import net.minecraft.util.Formatting;
|
import net.minecraft.util.Formatting;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
|
|
||||||
|
import org.saturnclient.saturnclient.client.player.Roles;
|
||||||
import org.saturnclient.saturnclient.client.player.SaturnPlayer;
|
import org.saturnclient.saturnclient.client.player.SaturnPlayer;
|
||||||
import org.saturnclient.saturnclient.config.SaturnClientConfig;
|
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@@ -43,8 +43,8 @@ public abstract class NameTagMixin<S extends EntityRenderState> {
|
|||||||
UUID uuid = isSaturn(state);
|
UUID uuid = isSaturn(state);
|
||||||
|
|
||||||
if (uuid != null) {
|
if (uuid != null) {
|
||||||
MutableText iconText = Text.literal(SaturnClientConfig.getSaturnIndicator())
|
MutableText iconText = Text.literal(Roles.getSaturnIndicator())
|
||||||
.styled(style -> style.withColor(SaturnClientConfig.getIconColor(uuid)));
|
.styled(style -> style.withColor(Roles.getIconColor(uuid)));
|
||||||
|
|
||||||
Text nameText = text.copy().styled(style -> style.withColor(Formatting.WHITE));
|
Text nameText = text.copy().styled(style -> style.withColor(Formatting.WHITE));
|
||||||
|
|
||||||
@@ -59,7 +59,9 @@ public abstract class NameTagMixin<S extends EntityRenderState> {
|
|||||||
if (state instanceof PlayerEntityRenderState) {
|
if (state instanceof PlayerEntityRenderState) {
|
||||||
String name = ((PlayerEntityRenderState) state).name;
|
String name = ((PlayerEntityRenderState) state).name;
|
||||||
SaturnPlayer player = SaturnPlayer.get(name);
|
SaturnPlayer player = SaturnPlayer.get(name);
|
||||||
return player.uuid;
|
if (player != null) {
|
||||||
|
return player.uuid;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ import net.minecraft.util.Formatting;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
import org.saturnclient.saturnclient.client.player.Roles;
|
||||||
import org.saturnclient.saturnclient.client.player.SaturnPlayer;
|
import org.saturnclient.saturnclient.client.player.SaturnPlayer;
|
||||||
import org.saturnclient.saturnclient.config.SaturnClientConfig;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Overwrite;
|
import org.spongepowered.asm.mixin.Overwrite;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
@@ -34,8 +34,8 @@ public abstract class TabListMixin {
|
|||||||
UUID uuid = profile.getId();
|
UUID uuid = profile.getId();
|
||||||
|
|
||||||
if (SaturnPlayer.get(uuid) != null) {
|
if (SaturnPlayer.get(uuid) != null) {
|
||||||
return Text.literal(SaturnClientConfig.getSaturnIndicator())
|
return Text.literal(Roles.getSaturnIndicator())
|
||||||
.styled(style -> style.withColor(SaturnClientConfig.getIconColor(uuid)))
|
.styled(style -> style.withColor(Roles.getIconColor(uuid)))
|
||||||
.append(Text.literal(name).styled(style -> style.withColor(Formatting.WHITE)));
|
.append(Text.literal(name).styled(style -> style.withColor(Formatting.WHITE)));
|
||||||
}
|
}
|
||||||
return Text.literal(name);
|
return Text.literal(name);
|
||||||
|
|||||||
Reference in New Issue
Block a user