From e621000d10da106fe79ee2cc331db7202b1ae443 Mon Sep 17 00:00:00 2001 From: NickAc <32451103+NickAcPT@users.noreply.github.com> Date: Wed, 7 Aug 2024 20:54:17 +0100 Subject: [PATCH] Fix when using ears but not having part_tracker enabled --- .../src/parts/provider/ears/mod.rs | 38 ++++++++++++------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/nmsr-3d-renderer/nmsr-player-parts/src/parts/provider/ears/mod.rs b/nmsr-3d-renderer/nmsr-player-parts/src/parts/provider/ears/mod.rs index 56b7dcb..dc0a782 100644 --- a/nmsr-3d-renderer/nmsr-player-parts/src/parts/provider/ears/mod.rs +++ b/nmsr-3d-renderer/nmsr-player-parts/src/parts/provider/ears/mod.rs @@ -18,13 +18,16 @@ use crate::{ snouts::EarsModSnoutsPartProvider, tails::EarsModTailsPartProvider, wings::EarsModWingsPartProvider, }, - minecraft::{get_part_group_name, MinecraftPlayerPartsProvider}, + minecraft::MinecraftPlayerPartsProvider, PartsProvider, }, }, types::{PlayerBodyPartType, PlayerPartTextureType}, }; +#[cfg(feature = "part_tracker")] +use crate::parts::provider::minecraft::get_part_group_name; + use super::PlayerPartProviderContext; pub(crate) mod ext; @@ -53,20 +56,27 @@ impl PartsProvider for EarsPlayerPartsProvider { let mut parts = Vec::new(); let mut builder = EarsModPartBuilder::new(&mut parts, &context); - builder.stack_group( - get_part_group_name(body_part.get_non_layer_part()), - |builder| { - for provider in EarsModPartStaticDispatch::iter() { - if !provider.provides_for_part(body_part) - || !provider.provides_for_feature(&features, context) - { - continue; - } - - provider.provide_parts(&features, context, builder, body_part); + let action = |builder: &mut EarsModPartBuilder| { + for provider in EarsModPartStaticDispatch::iter() { + if !provider.provides_for_part(body_part) + || !provider.provides_for_feature(&features, context) + { + continue; } - }, - ); + + provider.provide_parts(&features, context, builder, body_part); + } + }; + + #[cfg(feature = "part_tracker")] + { + builder.stack_group(get_part_group_name(body_part.get_non_layer_part()), action); + } + + #[cfg(not(feature = "part_tracker"))] + { + (action)(&mut builder); + } if features.emissive { handle_emissive(&mut parts, context, body_part);