mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-27 23:27:59 +01:00
Apply emote animations to the first person arm
This commit is contained in:
parent
054134545d
commit
802ba060ba
2 changed files with 20 additions and 0 deletions
|
@ -9,6 +9,7 @@ import com.minelittlepony.unicopia.util.AnimationUtil;
|
||||||
|
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.client.render.entity.model.BipedEntityModel;
|
import net.minecraft.client.render.entity.model.BipedEntityModel;
|
||||||
|
import net.minecraft.client.render.entity.model.PlayerEntityModel;
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.sound.SoundEvent;
|
import net.minecraft.sound.SoundEvent;
|
||||||
|
@ -154,6 +155,14 @@ public class PlayerPoser {
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (model instanceof PlayerEntityModel<?> m) {
|
||||||
|
m.leftSleeve.copyTransform(m.leftArm);
|
||||||
|
m.rightSleeve.copyTransform(m.rightArm);
|
||||||
|
m.leftPants.copyTransform(m.leftLeg);
|
||||||
|
m.rightPants.copyTransform(m.rightLeg);
|
||||||
|
}
|
||||||
|
model.hat.copyTransform(model.head);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void rearUp(MatrixStack matrices, BipedEntityModel<?> model, float progress) {
|
private void rearUp(MatrixStack matrices, BipedEntityModel<?> model, float progress) {
|
||||||
|
|
|
@ -4,9 +4,11 @@ import org.jetbrains.annotations.Nullable;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At.Shift;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
import com.minelittlepony.unicopia.client.render.AccessoryFeatureRenderer;
|
import com.minelittlepony.unicopia.client.render.AccessoryFeatureRenderer;
|
||||||
|
import com.minelittlepony.unicopia.client.render.PlayerPoser;
|
||||||
import com.minelittlepony.unicopia.client.render.AccessoryFeatureRenderer.FeatureRoot;
|
import com.minelittlepony.unicopia.client.render.AccessoryFeatureRenderer.FeatureRoot;
|
||||||
|
|
||||||
import net.minecraft.client.model.ModelPart;
|
import net.minecraft.client.model.ModelPart;
|
||||||
|
@ -42,4 +44,13 @@ abstract class MixinPlayerEntityRenderer extends LivingEntityRenderer<AbstractCl
|
||||||
Arm a = this.getModel().leftArm == arm ? Arm.LEFT : Arm.RIGHT;
|
Arm a = this.getModel().leftArm == arm ? Arm.LEFT : Arm.RIGHT;
|
||||||
getAccessories().renderArm(matrices, vertexConsumers, light, player, arm, a);
|
getAccessories().renderArm(matrices, vertexConsumers, light, player, arm, a);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Inject(method = "renderArm",
|
||||||
|
at = @At(
|
||||||
|
value = "INVOKE",
|
||||||
|
target = "Lnet/minecraft/client/render/entity/model/PlayerEntityModel;setAngles(Lnet/minecraft/entity/LivingEntity;FFFFF)V",
|
||||||
|
shift = Shift.AFTER))
|
||||||
|
private void onPoseArm(MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, AbstractClientPlayerEntity player, ModelPart arm, ModelPart sleeve, CallbackInfo info) {
|
||||||
|
PlayerPoser.INSTANCE.applyPosing(matrices, player, getModel());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue