Skip to content

Commit

Permalink
Fix when using ears but not having part_tracker enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
NickAcPT committed Aug 7, 2024
1 parent e621000 commit e621000
Showing 1 changed file with 24 additions and 14 deletions.
38 changes: 24 additions & 14 deletions nmsr-3d-renderer/nmsr-player-parts/src/parts/provider/ears/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -53,20 +56,27 @@ impl<M: ArmorMaterial> PartsProvider<M> 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<M>| {
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);
Expand Down

0 comments on commit e621000

Please sign in to comment.