2018-04-25 16:40:47 +02:00
|
|
|
package com.minelittlepony.model.player;
|
|
|
|
|
|
|
|
import com.minelittlepony.model.PMAPI;
|
2018-06-29 18:36:03 +02:00
|
|
|
import com.minelittlepony.render.player.RenderPonyPlayer;
|
|
|
|
import com.minelittlepony.render.player.RenderSeaponyPlayer;
|
|
|
|
|
|
|
|
import net.minecraft.client.renderer.entity.RenderManager;
|
|
|
|
|
2018-04-25 16:40:47 +02:00
|
|
|
import com.minelittlepony.model.ModelWrapper;
|
2018-04-24 14:55:32 +02:00
|
|
|
|
2018-04-24 17:12:23 +02:00
|
|
|
public enum PlayerModels {
|
2018-04-28 16:39:32 +02:00
|
|
|
/**
|
2018-06-22 01:46:10 +02:00
|
|
|
* The default non-pony model. This is typically handled my the vanilla renderer.
|
2018-04-28 16:39:32 +02:00
|
|
|
*/
|
2018-06-22 01:46:10 +02:00
|
|
|
DEFAULT("default", "slim", () -> PMAPI.earthpony, () -> PMAPI.earthponySmall),
|
2018-10-28 09:54:21 +01:00
|
|
|
EARTH("earthpony", () -> PMAPI.earthpony, () -> PMAPI.earthponySmall),
|
|
|
|
PEGASUS("pegasus", () -> PMAPI.pegasus, () -> PMAPI.pegasusSmall),
|
|
|
|
BATPONY("batpony", () -> PMAPI.bat, () -> PMAPI.batSmall),
|
|
|
|
UNICORN("unicorn", () -> PMAPI.unicorn, () -> PMAPI.unicornSmall),
|
|
|
|
ALICORN("alicorn", () -> PMAPI.alicorn, () -> PMAPI.alicornSmall),
|
|
|
|
CHANGELING("changeling", () -> PMAPI.bug, () -> PMAPI.bugSmall),
|
|
|
|
ZEBRA("zebra", () -> PMAPI.zebra, () -> PMAPI.zebraSmall),
|
|
|
|
SEAPONY("seapony", () -> PMAPI.seapony, () -> PMAPI.seapony) {
|
2018-09-07 21:16:07 +02:00
|
|
|
@Override
|
2018-06-29 18:36:03 +02:00
|
|
|
public RenderPonyPlayer createRenderer(RenderManager manager, boolean slimArms) {
|
|
|
|
return new RenderSeaponyPlayer(manager, slimArms, PlayerModels.UNICORN.getModel(slimArms), getModel(slimArms));
|
|
|
|
}
|
|
|
|
};
|
2018-04-24 17:12:23 +02:00
|
|
|
|
|
|
|
private final ModelResolver normal, slim;
|
|
|
|
|
|
|
|
private final String normalKey, slimKey;
|
|
|
|
|
2018-10-28 09:54:21 +01:00
|
|
|
PlayerModels(String key, ModelResolver normal, ModelResolver slim) {
|
|
|
|
this(key, "slim" + key, normal, slim);
|
|
|
|
}
|
|
|
|
|
2018-04-24 17:12:23 +02:00
|
|
|
PlayerModels(String normalKey, String slimKey, ModelResolver normal, ModelResolver slim) {
|
|
|
|
this.normalKey = normalKey;
|
2018-10-28 09:54:21 +01:00
|
|
|
this.slimKey = normalKey;
|
2018-04-24 17:12:23 +02:00
|
|
|
|
|
|
|
this.normal = normal;
|
|
|
|
this.slim = slim;
|
|
|
|
}
|
|
|
|
|
2018-04-25 16:40:47 +02:00
|
|
|
public ModelWrapper getModel(boolean slim) {
|
2018-04-28 16:39:32 +02:00
|
|
|
return slim ? this.slim.resolve() : normal.resolve();
|
2018-04-24 17:12:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public String getId(boolean useSlimArms) {
|
2018-04-28 16:39:32 +02:00
|
|
|
return useSlimArms ? slimKey : normalKey;
|
2018-04-24 17:12:23 +02:00
|
|
|
}
|
|
|
|
|
2018-06-29 18:36:03 +02:00
|
|
|
public RenderPonyPlayer createRenderer(RenderManager manager, boolean slimArms) {
|
|
|
|
return new RenderPonyPlayer(manager, slimArms, getModel(slimArms));
|
|
|
|
}
|
|
|
|
|
2018-04-24 17:12:23 +02:00
|
|
|
/**
|
|
|
|
* FIXME: PMAPI fields are null when the game starts.
|
|
|
|
*/
|
|
|
|
static interface ModelResolver {
|
2018-04-25 16:40:47 +02:00
|
|
|
ModelWrapper resolve();
|
2018-04-24 17:12:23 +02:00
|
|
|
}
|
2018-04-24 14:55:32 +02:00
|
|
|
}
|