Fixed crash when ancountering a guardian wearing armour

This commit is contained in:
Sollace 2019-11-30 17:19:16 +02:00
parent 2aafc214ac
commit 7f0163d47d
4 changed files with 15 additions and 1 deletions

View file

@ -39,6 +39,11 @@ public abstract class ClientPonyModel<T extends LivingEntity> extends MsonPlayer
attributes.updateLivingState(entity, pony, mode);
}
@Override
public void copyAttributes(BipedEntityModel<T> other) {
setAttributes(other);
}
@Override
public ModelAttributes<?> getAttributes() {
return attributes;

View file

@ -1,6 +1,7 @@
package com.minelittlepony.client.model;
import net.minecraft.client.model.ModelPart;
import net.minecraft.client.render.entity.model.BipedEntityModel;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.LivingEntity;
import net.minecraft.util.Arm;
@ -33,6 +34,11 @@ public interface IPonyMixinModel<T extends LivingEntity, M extends IPonyModel<T>
mixin().updateLivingState(entity, pony, mode);
}
@Override
default void copyAttributes(BipedEntityModel<T> other) {
mixin().copyAttributes(other);
}
@Override
default void transform(BodyPart part, MatrixStack stack) {
mixin().transform(part, stack);

View file

@ -1,6 +1,7 @@
package com.minelittlepony.client.model;
import net.minecraft.client.model.ModelPart;
import net.minecraft.client.render.entity.model.BipedEntityModel;
import net.minecraft.entity.LivingEntity;
import com.minelittlepony.client.render.EquineRenderManager;
@ -13,6 +14,8 @@ import com.minelittlepony.pony.IPony;
public interface IPonyModel<T extends LivingEntity> extends PonyModelConstants, IModel, ICapitated<ModelPart>, ICompartmented<ModelPart>, MsonModel {
void copyAttributes(BipedEntityModel<T> other);
void updateLivingState(T entity, IPony pony, EquineRenderManager.Mode mode);
@Override

View file

@ -58,7 +58,7 @@ public class ArmourFeature<T extends LivingEntity, M extends EntityModel<T> & IP
V armour = ArmourFeature.getArmorModel(entity, itemstack, armorSlot, layer, pony.<V>getArmor().getArmorForLayer(layer));
if (armour.prepareToRender(armorSlot, layer)) {
((BipedEntityModel<T>)pony.getBody()).setAttributes(armour);
pony.getBody().copyAttributes(armour);
armour.setAngles(entity, limbAngle, limbDistance, age, headYaw, headPitch);
armour.synchroniseLegs(pony.getBody());