From 7b0d6cc850f5cc1451b6ea009767fb6779f58110 Mon Sep 17 00:00:00 2001 From: TGGamesYT Date: Sun, 22 Feb 2026 16:34:58 +0100 Subject: [PATCH] cosmetics --- gradle.properties | 2 +- .../szar/client/ClientCosmetics.java | 115 ++++++++++++++++++ .../szar/client/mixin/TGcapeMixin.java | 23 ++++ .../szar/client/mixin/TGnameMixin.java | 27 ++++ src/client/resources/szar.client.mixins.json | 4 +- .../resources/assets/szar/lang/en_us.json | 4 +- .../szar/models/item/{atom.json => nuke.json} | 0 .../assets/szar/textures/etc/gabri_cape.png | Bin 0 -> 1655 bytes .../assets/szar/textures/etc/tg_cape.png | Bin 0 -> 1501 bytes 9 files changed, 171 insertions(+), 4 deletions(-) create mode 100644 src/client/java/dev/tggamesyt/szar/client/ClientCosmetics.java create mode 100644 src/client/java/dev/tggamesyt/szar/client/mixin/TGcapeMixin.java create mode 100644 src/client/java/dev/tggamesyt/szar/client/mixin/TGnameMixin.java rename src/main/resources/assets/szar/models/item/{atom.json => nuke.json} (100%) create mode 100644 src/main/resources/assets/szar/textures/etc/gabri_cape.png create mode 100644 src/main/resources/assets/szar/textures/etc/tg_cape.png diff --git a/gradle.properties b/gradle.properties index 5971ed7..d0a3409 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,7 +6,7 @@ minecraft_version=1.20.1 yarn_mappings=1.20.1+build.10 loader_version=0.18.3 # Mod Properties -mod_version=26.2.18 +mod_version=26.2.22 maven_group=dev.tggamesyt archives_base_name=szar # Dependencies diff --git a/src/client/java/dev/tggamesyt/szar/client/ClientCosmetics.java b/src/client/java/dev/tggamesyt/szar/client/ClientCosmetics.java new file mode 100644 index 0000000..8bf9951 --- /dev/null +++ b/src/client/java/dev/tggamesyt/szar/client/ClientCosmetics.java @@ -0,0 +1,115 @@ +package dev.tggamesyt.szar.client; + +import dev.tggamesyt.szar.Szar; +import net.minecraft.text.MutableText; +import net.minecraft.text.Text; +import net.minecraft.util.Formatting; +import net.minecraft.util.Identifier; +import net.minecraft.util.Util; +import net.minecraft.util.math.MathHelper; + +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +public class ClientCosmetics { + + public enum NameType { + STATIC, + GRADIENT + } + + public static class CosmeticProfile { + public final NameType nameType; + public final Formatting staticColor; // for STATIC names + public final Identifier capeTexture; // optional cape + public final int gradientStart; // RGB int, for GRADIENT + public final int gradientEnd; // RGB int, for GRADIENT + + public CosmeticProfile(NameType nameType, Formatting staticColor, Identifier capeTexture, + int gradientStart, int gradientEnd) { + this.nameType = nameType; + this.staticColor = staticColor; + this.capeTexture = capeTexture; + this.gradientStart = gradientStart; + this.gradientEnd = gradientEnd; + } + } + + // Registry + private static final Map PROFILES = new HashMap<>(); + + static { + // ===== TGdoesCode ===== animated gradient + PROFILES.put( + UUID.fromString("20bbb23e-2f22-46ba-b201-c6bd435b445b"), + new CosmeticProfile( + NameType.GRADIENT, + null, + new Identifier(Szar.MOD_ID, "textures/etc/tg_cape.png"), + 0x8CD6FF, // light blue + 0x00FFFF // cyan + ) + ); + + // ===== Berci08ur_mom ===== + PROFILES.put( + UUID.fromString("dda61748-15a4-45ff-9eea-29efc99c1711"), + new CosmeticProfile( + NameType.STATIC, + Formatting.GREEN, + new Identifier(Szar.MOD_ID, "textures/etc/gold_cape.png"), + 0, 0 + ) + ); + + // ===== gabri ===== + PROFILES.put( + UUID.fromString("52af5540-dd18-4ad9-9acb-50eb11531180"), + new CosmeticProfile( + NameType.STATIC, + Formatting.RED, + new Identifier(Szar.MOD_ID, "textures/etc/gbr_cape.png"), + 0, 0 + ) + ); + } + + public static CosmeticProfile getProfile(UUID uuid) { + return PROFILES.get(uuid); + } + + public static Text buildName(UUID uuid, String name) { + CosmeticProfile profile = PROFILES.get(uuid); + if (profile == null) return null; + + if (profile.nameType == NameType.STATIC) { + return Text.literal(name).formatted(profile.staticColor, Formatting.BOLD); + } + + // GRADIENT animation + long time = Util.getMeasuringTimeMs(); + MutableText animated = Text.empty(); + + for (int i = 0; i < name.length(); i++) { + // Animate wave + float progress = (time * 0.08f) + (i * 1.2f); + float wave = (float) Math.sin(progress); + float t = (wave + 1f) / 2f; // 0..1 + + // Interpolate RGB + int r = (int) MathHelper.lerp(t, (profile.gradientStart >> 16) & 0xFF, (profile.gradientEnd >> 16) & 0xFF); + int g = (int) MathHelper.lerp(t, (profile.gradientStart >> 8) & 0xFF, (profile.gradientEnd >> 8) & 0xFF); + int b = (int) MathHelper.lerp(t, profile.gradientStart & 0xFF, profile.gradientEnd & 0xFF); + + int color = (r << 16) | (g << 8) | b; + + animated.append( + Text.literal(String.valueOf(name.charAt(i))) + .styled(style -> style.withColor(color).withBold(true)) + ); + } + + return animated; + } +} \ No newline at end of file diff --git a/src/client/java/dev/tggamesyt/szar/client/mixin/TGcapeMixin.java b/src/client/java/dev/tggamesyt/szar/client/mixin/TGcapeMixin.java new file mode 100644 index 0000000..170bc99 --- /dev/null +++ b/src/client/java/dev/tggamesyt/szar/client/mixin/TGcapeMixin.java @@ -0,0 +1,23 @@ +package dev.tggamesyt.szar.client.mixin; + +import dev.tggamesyt.szar.client.ClientCosmetics; +import net.minecraft.client.network.AbstractClientPlayerEntity; +import net.minecraft.util.Identifier; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +@Mixin(AbstractClientPlayerEntity.class) +public abstract class TGcapeMixin { + + @Inject(method = "getCapeTexture", at = @At("HEAD"), cancellable = true) + private void injectCapeTexture(CallbackInfoReturnable cir) { + AbstractClientPlayerEntity self = (AbstractClientPlayerEntity)(Object)this; + + var profile = ClientCosmetics.getProfile(self.getUuid()); + if (profile != null && profile.capeTexture != null) { + cir.setReturnValue(profile.capeTexture); + } + } +} \ No newline at end of file diff --git a/src/client/java/dev/tggamesyt/szar/client/mixin/TGnameMixin.java b/src/client/java/dev/tggamesyt/szar/client/mixin/TGnameMixin.java new file mode 100644 index 0000000..98fc6e1 --- /dev/null +++ b/src/client/java/dev/tggamesyt/szar/client/mixin/TGnameMixin.java @@ -0,0 +1,27 @@ +package dev.tggamesyt.szar.client.mixin; + +import dev.tggamesyt.szar.client.ClientCosmetics; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.text.Text; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +@Mixin(PlayerEntity.class) +public abstract class TGnameMixin { + + @Inject(method = "getDisplayName", at = @At("HEAD"), cancellable = true) + private void overrideName(CallbackInfoReturnable cir) { + PlayerEntity self = (PlayerEntity)(Object)this; + + Text custom = ClientCosmetics.buildName( + self.getUuid(), + self.getGameProfile().getName() + ); + + if (custom != null) { + cir.setReturnValue(custom); + } + } +} \ No newline at end of file diff --git a/src/client/resources/szar.client.mixins.json b/src/client/resources/szar.client.mixins.json index e96ea3c..c67f807 100644 --- a/src/client/resources/szar.client.mixins.json +++ b/src/client/resources/szar.client.mixins.json @@ -7,7 +7,9 @@ "MouseMixin", "RadiationHeartMixin", "RadiatedItemRendererMixin", - "SplashOverlayMixin" + "SplashOverlayMixin", + "TGnameMixin", + "TGcapeMixin" ], "injectors": { "defaultRequire": 1 diff --git a/src/main/resources/assets/szar/lang/en_us.json b/src/main/resources/assets/szar/lang/en_us.json index a1cf5ae..1070496 100644 --- a/src/main/resources/assets/szar/lang/en_us.json +++ b/src/main/resources/assets/szar/lang/en_us.json @@ -56,12 +56,12 @@ "item.szar.epstein_spawn_egg": "Epstein Spawn Egg", "item.szar.detonator": "Detonator", - "entity.szar.atom": "Atom", + "entity.szar.nuke": "Nuke", "block.szar.uranium_ore": "Uranium Ore", "item.szar.uranium": "Uranium", "item.szar.uranium_rod": "Uranium Rod", "item.szar.nuke_core": "Nuke Core", - "item.szar.atom": "Nuke", + "item.szar.nuke": "Nuke", "effect.szar.radiation": "Radiation", "item.szar.baiter": "Music Disc", "item.szar.baiter.desc": "HaVexy - Hyperabaiter Disstrack", diff --git a/src/main/resources/assets/szar/models/item/atom.json b/src/main/resources/assets/szar/models/item/nuke.json similarity index 100% rename from src/main/resources/assets/szar/models/item/atom.json rename to src/main/resources/assets/szar/models/item/nuke.json diff --git a/src/main/resources/assets/szar/textures/etc/gabri_cape.png b/src/main/resources/assets/szar/textures/etc/gabri_cape.png new file mode 100644 index 0000000000000000000000000000000000000000..2e9a131336c198096e86e88f9ed6c49141d7c425 GIT binary patch literal 1655 zcmY*ZdpOit82(LSGP7ihSi_RsGsdtOlX1V_8$?o?F~baIjJYsoa!HL#^GHJLl0x+; ztaVE+p`t=mZ0JJCy;Q1)+}Yo>o_6<-bI$jD=lkC8J@0wWN%Qh>l!7V3005A3cCy2R zs}(p@cSwM9Nn!kHaDlM!jy6E$W2JYXvpv+>-5LO@GvI3kanP4!I2~pIfb>1lfXHdP zB!UGgR3Cq~zq=bYIFhDMAVm_%`dk_V%mx5+OD=;D98PAd63L-dI!x#VJidlaB37bn}J24Vq#+SV~q48nV~4OnVA{Nzz}6jV2M01d#(pdcvG4hpSrAfha?v7SsS8Dt@9X@NHXzW=|NIZ8z2 zKg2BliGXJXtslyWWcr~lnGQ-C18S$2oeKxAE!Nr2+J|EMF&7tc#8)=4jsL|p_2bo? zSgB(7GVSf9doNfiH+gxLOWXT4$#OJYpt-umK9XgLNU`f>f|+bcN%Y63d+{2c2H6^j zq;qvHuH_rsGOWfg%S5~;a9dH|!iPJa(B;>h2UpF89xe{^A2&|>LniuLw#gvU@WM44 zNKbCum!jvvI*#$hRwu?T!Ooc28afk#l)hcm+#Cq)a44COhxz((<{#9v1@^wbvExQnD%&*s7OKXytKn;F^>9E=i`j1rJ&y5-Y$Ii<)UhLx_ z)bp+~CMp&goA;87JpL?`H?B+;SG^`6ts*68Hx#QrXwxfpe$HzCvZ{mJs7;3_o~k_G z+f6*W`&;|TunhRP??RF0z`1$K{e6CzftdZ;(9wcsv0U^N?CF*AY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