Added villagers head rolling while saying no

This commit is contained in:
keupoz 2019-07-25 16:57:00 +07:00
parent 2676503d98
commit 0cfede5f68

View file

@ -2,6 +2,8 @@ package com.minelittlepony.client.model.entities;
import net.minecraft.client.render.entity.model.ModelWithHat;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.passive.AbstractTraderEntity;
import net.minecraft.util.math.MathHelper;
import net.minecraft.village.VillagerDataContainer;
import net.minecraft.village.VillagerProfession;
@ -81,4 +83,27 @@ public class ModelVillagerPony<T extends LivingEntity & VillagerDataContainer> e
public void setHatVisible(boolean visible) {
}
@Override
public void setAngles(T entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
super.setAngles(entity, move, swing, ticks, headYaw, headPitch, scale);
boolean isHeadRolling = false;
if (entity instanceof AbstractTraderEntity) {
isHeadRolling = ((AbstractTraderEntity)entity).getHeadRollingTimeLeft() > 0;
}
if (isHeadRolling) {
float roll = 0.3F * MathHelper.sin(0.45F * ticks);
this.head.roll = roll;
this.headwear.roll = roll;
this.head.pitch = 0.4F;
this.headwear.pitch = 0.4F;
} else {
this.head.roll = 0.0F;
this.headwear.roll = 0.0F;
}
}
}