Unicorns will swing their arms to punch when not holding anything

This commit is contained in:
Sollace 2019-07-18 09:29:07 +02:00
parent ab3cd3f307
commit a18b2a46d9
2 changed files with 9 additions and 5 deletions

View file

@ -3,6 +3,7 @@ package com.minelittlepony.client.model;
import net.minecraft.client.model.Cuboid;
import net.minecraft.client.render.entity.model.BipedEntityModel;
import net.minecraft.client.render.entity.model.PlayerEntityModel;
import net.minecraft.client.render.entity.model.BipedEntityModel.ArmPose;
import net.minecraft.entity.LivingEntity;
import net.minecraft.util.AbsoluteHand;
@ -85,6 +86,10 @@ public abstract class ClientPonyModel<T extends LivingEntity> extends PlayerEnti
return super.getArm(side);
}
public ArmPose getArmPoseForSide(AbsoluteHand side) {
return side == AbsoluteHand.RIGHT ? rightArmPose : leftArmPose;
}
/**
* Copies this model's attributes into the passed model.
*/

View file

@ -45,10 +45,6 @@ public class ModelUnicorn<T extends LivingEntity> extends ModelEarthPony<T> impl
unicornArmLeft.rotate(0, 0, 0).around(-7, 12, -2);
}
public ArmPose getArmPoseForSide(AbsoluteHand side) {
return side == AbsoluteHand.RIGHT ? rightArmPose : leftArmPose;
}
@Override
protected void animateBreathing(float ticks) {
if (canCast()) {
@ -124,6 +120,9 @@ public class ModelUnicorn<T extends LivingEntity> extends ModelEarthPony<T> impl
@Override
public Cuboid getArm(AbsoluteHand side) {
return canCast() ? getUnicornArmForSide(side) : super.getArm(side);
if (canCast() && getArmPoseForSide(side) != ArmPose.EMPTY) {
return getUnicornArmForSide(side);
}
return super.getArm(side);
}
}