2016-11-17 05:45:04 +01:00
|
|
|
package com.minelittlepony.model;
|
2015-08-02 00:36:33 +02:00
|
|
|
|
2018-04-25 16:40:47 +02:00
|
|
|
import com.minelittlepony.model.armour.PonyArmor;
|
2018-05-01 12:38:13 +02:00
|
|
|
import com.minelittlepony.model.capabilities.IModelWrapper;
|
2018-04-25 13:02:10 +02:00
|
|
|
import com.minelittlepony.pony.data.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.
|
|
|
|
*/
|
2018-05-01 12:38:13 +02:00
|
|
|
public class ModelWrapper implements IModelWrapper {
|
2015-08-02 00:36:33 +02:00
|
|
|
|
2018-06-10 18:16:37 +02:00
|
|
|
private final AbstractPonyModel body;
|
2018-04-25 16:40:47 +02:00
|
|
|
private final PonyArmor armor;
|
2015-12-09 04:14:42 +01:00
|
|
|
|
2018-04-25 21:29:49 +02:00
|
|
|
/**
|
|
|
|
* Created a new model wrapper to contain the given pony.
|
|
|
|
*/
|
2018-04-25 16:40:47 +02:00
|
|
|
public ModelWrapper(AbstractPonyModel model) {
|
2018-05-26 22:47:38 +02:00
|
|
|
body = model;
|
2018-04-27 13:49:33 +02:00
|
|
|
armor = model.createArmour();
|
|
|
|
armor.apply(model.metadata);
|
2015-08-02 00:36:33 +02:00
|
|
|
}
|
|
|
|
|
2018-06-10 18:16:37 +02:00
|
|
|
public AbstractPonyModel getBody() {
|
|
|
|
return body;
|
2015-08-02 00:36:33 +02:00
|
|
|
}
|
|
|
|
|
2018-04-25 21:29:49 +02:00
|
|
|
/**
|
|
|
|
* Returns the contained armour model.
|
|
|
|
* @return
|
|
|
|
*/
|
2018-04-25 16:40:47 +02:00
|
|
|
public PonyArmor getArmor() {
|
2015-12-09 04:14:42 +01:00
|
|
|
return armor;
|
2015-08-02 00:36:33 +02:00
|
|
|
}
|
2016-11-25 05:40:19 +01:00
|
|
|
|
2018-04-24 14:55:32 +02:00
|
|
|
public void apply(IPonyData meta) {
|
2018-06-10 18:16:37 +02:00
|
|
|
body.metadata = meta;
|
2015-12-09 04:14:42 +01:00
|
|
|
armor.apply(meta);
|
2015-08-02 00:36:33 +02:00
|
|
|
}
|
2018-04-27 13:49:33 +02:00
|
|
|
|
2018-04-25 21:29:49 +02:00
|
|
|
public void init() {
|
2018-06-10 18:16:37 +02:00
|
|
|
body.init(0, 0);
|
2018-04-25 21:29:49 +02:00
|
|
|
armor.init();
|
|
|
|
}
|
2015-08-02 00:36:33 +02:00
|
|
|
}
|