From 0cfede5f681f88ed7f308ba8c8ef34710c11dfa2 Mon Sep 17 00:00:00 2001 From: keupoz Date: Thu, 25 Jul 2019 16:57:00 +0700 Subject: [PATCH] Added villagers head rolling while saying no --- .../model/entities/ModelVillagerPony.java | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/main/java/com/minelittlepony/client/model/entities/ModelVillagerPony.java b/src/main/java/com/minelittlepony/client/model/entities/ModelVillagerPony.java index a4084641..68f82570 100644 --- a/src/main/java/com/minelittlepony/client/model/entities/ModelVillagerPony.java +++ b/src/main/java/com/minelittlepony/client/model/entities/ModelVillagerPony.java @@ -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 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; + } + } }