2019-05-27 17:59:15 +02:00
|
|
|
package com.minelittlepony.client.model;
|
|
|
|
|
2019-11-22 18:24:22 +01:00
|
|
|
import net.minecraft.client.model.ModelPart;
|
2019-06-24 11:25:39 +02:00
|
|
|
import net.minecraft.client.render.entity.model.BipedEntityModel;
|
2019-05-27 17:59:15 +02:00
|
|
|
import net.minecraft.client.render.entity.model.PlayerEntityModel;
|
|
|
|
import net.minecraft.entity.LivingEntity;
|
2019-07-20 20:16:54 +02:00
|
|
|
import net.minecraft.util.Arm;
|
2019-05-27 17:59:15 +02:00
|
|
|
|
2019-06-24 11:25:39 +02:00
|
|
|
import com.minelittlepony.client.pony.PonyData;
|
|
|
|
import com.minelittlepony.model.ModelAttributes;
|
|
|
|
import com.minelittlepony.pony.IPony;
|
|
|
|
import com.minelittlepony.pony.IPonyData;
|
|
|
|
import com.minelittlepony.pony.meta.Size;
|
2019-05-27 17:59:15 +02:00
|
|
|
|
2019-06-24 11:25:39 +02:00
|
|
|
/**
|
|
|
|
* The raw pony model without any implementations.
|
|
|
|
* Will act effectively the same as a normal player model without any hints
|
|
|
|
* of being cute and adorable.
|
|
|
|
*
|
|
|
|
* Modders can extend this class to make their own pony models if they wish.
|
|
|
|
*/
|
2019-05-27 17:59:15 +02:00
|
|
|
public abstract class ClientPonyModel<T extends LivingEntity> extends PlayerEntityModel<T> implements IPonyModel<T> {
|
|
|
|
|
2019-06-24 11:25:39 +02:00
|
|
|
/**
|
|
|
|
* The model attributes.
|
|
|
|
*/
|
|
|
|
protected ModelAttributes<T> attributes = new ModelAttributes<>();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Associated pony data.
|
|
|
|
*/
|
|
|
|
protected IPonyData metadata = new PonyData();
|
|
|
|
|
2019-05-27 17:59:15 +02:00
|
|
|
public ClientPonyModel(float float_1, boolean boolean_1) {
|
|
|
|
super(float_1, boolean_1);
|
|
|
|
}
|
|
|
|
|
2019-06-24 11:25:39 +02:00
|
|
|
@Override
|
|
|
|
public void updateLivingState(T entity, IPony pony) {
|
|
|
|
isChild = entity.isBaby();
|
2019-07-15 09:37:43 +02:00
|
|
|
isSneaking = entity.isInSneakingPose();
|
2019-06-24 11:25:39 +02:00
|
|
|
attributes.updateLivingState(entity, pony);
|
|
|
|
}
|
|
|
|
|
2019-11-23 18:28:42 +01:00
|
|
|
// Broken bridge
|
|
|
|
@Override
|
|
|
|
public void setAngles(T entity, float move, float swing, float ticks, float headYaw, float headPitch) {
|
|
|
|
super.method_17087(entity, move, swing, ticks, headYaw, headPitch);
|
|
|
|
}
|
|
|
|
|
2019-06-24 11:25:39 +02:00
|
|
|
@Override
|
|
|
|
public ModelAttributes<?> getAttributes() {
|
|
|
|
return attributes;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public IPonyData getMetadata() {
|
|
|
|
return metadata;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public Size getSize() {
|
|
|
|
return isChild ? Size.FOAL : getMetadata().getSize();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void apply(IPonyData meta) {
|
|
|
|
metadata = meta;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2019-11-22 18:24:22 +01:00
|
|
|
public ModelPart getHead() {
|
2019-06-24 11:25:39 +02:00
|
|
|
return head;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean isRiding() {
|
|
|
|
return isRiding;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public float getSwingAmount() {
|
|
|
|
return handSwingProgress;
|
|
|
|
}
|
|
|
|
|
2019-06-27 15:50:34 +02:00
|
|
|
|
|
|
|
@Override
|
2019-11-22 18:24:22 +01:00
|
|
|
public ModelPart getArm(Arm side) {
|
2019-06-27 15:50:34 +02:00
|
|
|
return super.getArm(side);
|
|
|
|
}
|
|
|
|
|
2019-07-20 20:16:54 +02:00
|
|
|
public ArmPose getArmPoseForSide(Arm side) {
|
|
|
|
return side == Arm.RIGHT ? rightArmPose : leftArmPose;
|
2019-07-18 09:29:07 +02:00
|
|
|
}
|
|
|
|
|
2019-06-24 11:25:39 +02:00
|
|
|
/**
|
2019-06-24 13:12:13 +02:00
|
|
|
* Copies this model's attributes into the passed model.
|
2019-06-24 11:25:39 +02:00
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
public void setAttributes(BipedEntityModel<T> model) {
|
|
|
|
super.setAttributes(model);
|
|
|
|
|
|
|
|
if (model instanceof ClientPonyModel) {
|
2019-06-24 13:11:51 +02:00
|
|
|
((ClientPonyModel<T>)model).attributes = attributes;
|
|
|
|
((ClientPonyModel<T>)model).metadata = metadata;
|
2019-06-24 11:25:39 +02:00
|
|
|
}
|
|
|
|
}
|
2019-05-27 17:59:15 +02:00
|
|
|
}
|