#How to make armor rendering to client player only

5 messages · Page 1 of 1 (latest)

peak quest
#

hey guys, i'm new here and new to modding.
I need help with my mod, the mod works but the armor visibility works on everyone and I want to make that it affects only the local player.

my mixin:

@Mixin(ArmorFeatureRenderer.class)
public abstract class ArmorHideMixin {
    @Inject(method = "renderArmor", at = @At("HEAD"), cancellable = true)
    private void onRender(MatrixStack matrices, VertexConsumerProvider vertexConsumers,
                         ItemStack stack, EquipmentSlot slot, 
                         int light, BipedEntityModel<?> armorModel, CallbackInfo ci) {
        MinecraftClient client = MinecraftClient.getInstance();

        if (client.player != null && HideArmor.isHidden) {
            ci.cancel();
        }
    }
}
pale harness
#

well yes

#

you are just checking if the local player exists and then cancelling

#

the local player will almost always exist when rendering unless something really jank is going on