2019-03-23 20:49:34 +01:00
|
|
|
package com.minelittlepony.client.model;
|
2015-08-02 00:36:33 +02:00
|
|
|
|
2019-05-27 17:59:15 +02:00
|
|
|
import net.minecraft.entity.LivingEntity;
|
|
|
|
|
|
|
|
import com.minelittlepony.model.IModel;
|
|
|
|
import com.minelittlepony.model.armour.IArmour;
|
2019-03-23 20:58:50 +01:00
|
|
|
import com.minelittlepony.model.armour.IEquestrianArmour;
|
2018-05-01 12:38:13 +02:00
|
|
|
import com.minelittlepony.model.capabilities.IModelWrapper;
|
2019-03-23 20:58:50 +01:00
|
|
|
import com.minelittlepony.pony.IPonyData;
|
2015-11-17 06:09:04 +01:00
|
|
|
|
2018-04-25 21:29:49 +02:00
|
|
|
/**
|
|
|
|
* Container class for the various models and their associated piece of armour.
|
|
|
|
*/
|
2019-05-27 17:59:15 +02:00
|
|
|
public class ModelWrapper<T extends LivingEntity, M extends IModel> implements IModelWrapper {
|
2015-08-02 00:36:33 +02:00
|
|
|
|
2019-05-27 17:59:15 +02:00
|
|
|
private final M body;
|
2018-10-12 18:01:23 +02:00
|
|
|
|
2019-03-23 18:48:20 +01:00
|
|
|
private final IEquestrianArmour<?> armor;
|
2015-12-09 04:14:42 +01:00
|
|
|
|
2018-04-25 21:29:49 +02:00
|
|
|
/**
|
2018-08-17 23:12:40 +02:00
|
|
|
* Creates a new model wrapper to contain the given pony.
|
2018-04-25 21:29:49 +02:00
|
|
|
*/
|
2019-05-27 17:59:15 +02:00
|
|
|
public ModelWrapper(M model) {
|
2018-05-26 22:47:38 +02:00
|
|
|
body = model;
|
2018-04-27 13:49:33 +02:00
|
|
|
armor = model.createArmour();
|
2018-08-17 22:46:28 +02:00
|
|
|
armor.apply(model.getMetadata());
|
2015-08-02 00:36:33 +02:00
|
|
|
}
|
|
|
|
|
2019-05-27 17:59:15 +02:00
|
|
|
public M getBody() {
|
2018-06-10 18:16:37 +02:00
|
|
|
return body;
|
2015-08-02 00:36:33 +02:00
|
|
|
}
|
|
|
|
|
2018-04-25 21:29:49 +02:00
|
|
|
/**
|
|
|
|
* Returns the contained armour model.
|
|
|
|
*/
|
2019-05-27 17:59:15 +02:00
|
|
|
@SuppressWarnings("unchecked")
|
|
|
|
public <V extends IArmour> IEquestrianArmour<V> getArmor() {
|
|
|
|
return (IEquestrianArmour<V>)armor;
|
2015-08-02 00:36:33 +02:00
|
|
|
}
|
2016-11-25 05:40:19 +01:00
|
|
|
|
2018-09-07 21:16:07 +02:00
|
|
|
@Override
|
2018-04-24 14:55:32 +02:00
|
|
|
public void apply(IPonyData meta) {
|
2019-04-14 22:06:25 +02:00
|
|
|
body.apply(meta);
|
2015-12-09 04:14:42 +01:00
|
|
|
armor.apply(meta);
|
2015-08-02 00:36:33 +02:00
|
|
|
}
|
|
|
|
}
|