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
@@ -28,20 +28,16 @@ public class SaturnClient implements ModInitializer {
public static ConfigManager config = new ConfigManager("Saturn Client"); public static ConfigManager config = new ConfigManager("Saturn Client");
public static Property<Integer> COLOR = config.property( public static Property<Integer> COLOR = config.property(
"Primary color", "Primary color",
new Property<Integer>( new Property<Integer>(
ColorHelper.getArgb(255, 251, 60, 79), ColorHelper.getArgb(255, 251, 60, 79),
Property.PropertyType.HEX Property.PropertyType.HEX));
)
);
public static Property<Integer> NORMAL = config.property( public static Property<Integer> NORMAL = config.property(
"Default color", "Default color",
new Property<Integer>( new Property<Integer>(
ColorHelper.getArgb(255, 182, 182, 182), ColorHelper.getArgb(255, 182, 182, 182),
Property.PropertyType.HEX Property.PropertyType.HEX));
)
);
public static int WHITE = ColorHelper.getArgb(255, 255, 255, 255); public static int WHITE = ColorHelper.getArgb(255, 255, 255, 255);
public static TextRenderer textRenderer = null; public static TextRenderer textRenderer = null;
@@ -60,9 +56,7 @@ public class SaturnClient implements ModInitializer {
ModManager.init(); ModManager.init();
ConfigManager.load(); ConfigManager.load();
ClientLifecycleEvents.CLIENT_STOPPING.register(_o -> ClientLifecycleEvents.CLIENT_STOPPING.register(_o -> ConfigManager.save());
ConfigManager.save()
);
KeyInputHandler.register(); KeyInputHandler.register();
if (SaturnSocket.authenticate()) { 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", "minVersion": "0.8",
"package": "org.saturnclient.saturnclient.mixin", "package": "org.saturnclient.saturnclient.mixin",
"compatibilityLevel": "JAVA_17", "compatibilityLevel": "JAVA_17",
"client": ["CapeRenderer", "TabListMixin", "NameTagMixin"], "client": [
"CapeRenderer",
"TabListMixin",
"NameTagMixin",
"ArmorFeatureRendererMixin"
],
"injectors": { "injectors": {
"defaultRequire": 1 "defaultRequire": 1
} }