Merge pull request #126 from keupoz/master

Added villagers head rolling while saying no
This commit is contained in:
­Sollace 2019-07-25 12:53:06 +02:00 committed by GitHub
commit d0f1668d07
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,6 +2,8 @@ package com.minelittlepony.client.model.entities;
import net.minecraft.client.render.entity.model.ModelWithHat; import net.minecraft.client.render.entity.model.ModelWithHat;
import net.minecraft.entity.LivingEntity; 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.VillagerDataContainer;
import net.minecraft.village.VillagerProfession; import net.minecraft.village.VillagerProfession;
@ -81,4 +83,27 @@ public class ModelVillagerPony<T extends LivingEntity & VillagerDataContainer> e
public void setHatVisible(boolean visible) { 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;
}
}
} }