mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2025-02-23 20:54:32 +01:00
46 lines
1.2 KiB
Java
46 lines
1.2 KiB
Java
package com.minelittlepony.client.model;
|
|
|
|
import net.minecraft.entity.LivingEntity;
|
|
|
|
import com.minelittlepony.model.IModel;
|
|
import com.minelittlepony.model.armour.IArmour;
|
|
import com.minelittlepony.model.armour.IEquestrianArmour;
|
|
import com.minelittlepony.model.capabilities.IModelWrapper;
|
|
import com.minelittlepony.pony.IPonyData;
|
|
|
|
/**
|
|
* Container class for the various models and their associated piece of armour.
|
|
*/
|
|
public class ModelWrapper<T extends LivingEntity, M extends IModel> implements IModelWrapper {
|
|
|
|
private final M body;
|
|
|
|
private final IEquestrianArmour<?> armor;
|
|
|
|
/**
|
|
* Creates a new model wrapper to contain the given pony.
|
|
*/
|
|
public ModelWrapper(M model) {
|
|
body = model;
|
|
armor = model.createArmour();
|
|
armor.apply(model.getMetadata());
|
|
}
|
|
|
|
public M getBody() {
|
|
return body;
|
|
}
|
|
|
|
/**
|
|
* Returns the contained armour model.
|
|
*/
|
|
@SuppressWarnings("unchecked")
|
|
public <V extends IArmour> IEquestrianArmour<V> getArmor() {
|
|
return (IEquestrianArmour<V>)armor;
|
|
}
|
|
|
|
@Override
|
|
public void apply(IPonyData meta) {
|
|
body.apply(meta);
|
|
armor.apply(meta);
|
|
}
|
|
}
|