Fix player animations being applied to all instances of the model

This commit is contained in:
Electroblob77
2020-10-17 13:02:09 +01:00
parent 6f57d2366e
commit 795bdcd427
@@ -143,16 +143,12 @@ public class PlayerAnimator {
} }
} }
boolean flag = false;
for(Animation animation : animations){ for(Animation animation : animations){
if(animation.shouldDisplay(player, firstPerson)){ if(animation.shouldDisplay(player, firstPerson)){
boolean autoRotateSecondLayer = animation.autoRotateSecondLayer(player, firstPerson); boolean autoRotateSecondLayer = animation.autoRotateSecondLayer(player, firstPerson);
flag = true;
for(ModelBiped model : playerLayerModels.get(renderer)){ for(ModelBiped model : playerLayerModels.get(renderer)){
animation.setRotationAngles(player, model, partialTicks, firstPerson); animation.setRotationAngles(player, model, partialTicks, firstPerson);
@@ -164,17 +160,6 @@ public class PlayerAnimator {
} }
} }
if(!flag){
for(ModelBiped model : playerLayerModels.get(renderer)){
for(ModelRenderer box : model.boxList){ // For ModelPlayer, this will include the second layer
// Some models have extra boxes, they (probably) don't need wrapping but we need this check!
if(box instanceof ModelRendererExtended){
((ModelRendererExtended)box).resetRotation();
}
}
}
}
} }
/** Rotates the second layer boxes of the given (wrapped) player model to match the first layer. */ /** Rotates the second layer boxes of the given (wrapped) player model to match the first layer. */
@@ -216,9 +201,20 @@ public class PlayerAnimator {
updateModels(event.getEntityPlayer(), event.getRenderer(), event.getPartialRenderTick(), false); updateModels(event.getEntityPlayer(), event.getRenderer(), event.getPartialRenderTick(), false);
} }
// @SubscribeEvent @SubscribeEvent
// public static void onRenderPlayerPostEvent(RenderPlayerEvent.Post event){ public static void onRenderPlayerPostEvent(RenderPlayerEvent.Post event){
// TODO: Would we ever need to unwrap the models?
// } if(!Wizardry.settings.spellcastingAnimations) return;
for(ModelBiped model : playerLayerModels.get(event.getRenderer())){
for(ModelRenderer box : model.boxList){ // For ModelPlayer, this will include the second layer
// Some models have extra boxes, they (probably) don't need wrapping but we need this check!
if(box instanceof ModelRendererExtended){
((ModelRendererExtended)box).resetRotation();
}
}
}
}
} }