From babd54bb874c5fcfd275237287e2b73a5fb2412c Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Mon, 9 May 2016 20:40:53 +0300 Subject: [PATCH] Fixed joint hierarchy not being used fully in the animation system. --- .../minecraftforge/common/model/animation/Clips.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/minecraftforge/common/model/animation/Clips.java b/src/main/java/net/minecraftforge/common/model/animation/Clips.java index 7f588db04..8528b335c 100644 --- a/src/main/java/net/minecraftforge/common/model/animation/Clips.java +++ b/src/main/java/net/minecraftforge/common/model/animation/Clips.java @@ -282,11 +282,17 @@ public final class Clips return Optional.absent(); } IJoint joint = (IJoint)part.get(); - if(!joint.getParent().isPresent()) + TRSRTransformation jointTransform = clip.apply(joint).apply(time).compose(joint.getInvBindPose()); + Optional parentTransform = Optional.absent(); + if(joint.getParent().isPresent()) { - return Optional.of(clip.apply(joint).apply(time).compose(joint.getInvBindPose())); + parentTransform = apply(Optional.of(joint.getParent().get())); } - return Optional.of(clip.apply(joint.getParent().get()).apply(time).compose(clip.apply(joint).apply(time)).compose(joint.getInvBindPose())); + if(parentTransform.isPresent()) + { + jointTransform = parentTransform.get().compose(jointTransform); + } + return Optional.of(jointTransform); } }, clip.pastEvents(lastPollTime, time)); }