diamond armor rendering (for hats)

This commit is contained in:
2025-03-27 18:56:43 +01:00
parent 47a452ec83
commit b482670b0f
3 changed files with 36 additions and 16 deletions
@@ -31,17 +31,13 @@ public class SaturnClient implements ModInitializer {
"Primary color",
new Property<Integer>(
ColorHelper.getArgb(255, 251, 60, 79),
Property.PropertyType.HEX
)
);
Property.PropertyType.HEX));
public static Property<Integer> NORMAL = config.property(
"Default color",
new Property<Integer>(
ColorHelper.getArgb(255, 182, 182, 182),
Property.PropertyType.HEX
)
);
Property.PropertyType.HEX));
public static int WHITE = ColorHelper.getArgb(255, 255, 255, 255);
public static TextRenderer textRenderer = null;
@@ -60,9 +56,7 @@ public class SaturnClient implements ModInitializer {
ModManager.init();
ConfigManager.load();
ClientLifecycleEvents.CLIENT_STOPPING.register(_o ->
ConfigManager.save()
);
ClientLifecycleEvents.CLIENT_STOPPING.register(_o -> ConfigManager.save());
KeyInputHandler.register();
if (SaturnSocket.authenticate()) {
@@ -0,0 +1,21 @@
package org.saturnclient.saturnclient.mixin;
import net.minecraft.client.render.entity.feature.ArmorFeatureRenderer;
import net.minecraft.client.render.entity.state.BipedEntityRenderState;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(ArmorFeatureRenderer.class)
public class ArmorFeatureRendererMixin {
@Redirect(method = "render", at = @At(value = "FIELD", target = "Lnet/minecraft/client/render/entity/state/BipedEntityRenderState;equippedHeadStack:Lnet/minecraft/item/ItemStack;", opcode = org.objectweb.asm.Opcodes.GETFIELD))
private ItemStack redirectEquippedHeadStack(BipedEntityRenderState state) {
ItemStack original = state.equippedHeadStack;
if (original.isEmpty()) {
return new ItemStack(Items.DIAMOND_HELMET);
}
return original;
}
}
+6 -1
View File
@@ -3,7 +3,12 @@
"minVersion": "0.8",
"package": "org.saturnclient.saturnclient.mixin",
"compatibilityLevel": "JAVA_17",
"client": ["CapeRenderer", "TabListMixin", "NameTagMixin"],
"client": [
"CapeRenderer",
"TabListMixin",
"NameTagMixin",
"ArmorFeatureRendererMixin"
],
"injectors": {
"defaultRequire": 1
}