MineLittlePony/src/main/java/com/minelittlepony/model/player/PlayerModels.java

59 lines
2.1 KiB
Java
Raw Normal View History

package com.minelittlepony.model.player;
import com.minelittlepony.model.PMAPI;
import com.minelittlepony.render.player.RenderPonyPlayer;
import com.minelittlepony.render.player.RenderSeaponyPlayer;
import net.minecraft.client.renderer.entity.RenderManager;
import com.minelittlepony.model.ModelWrapper;
2018-04-24 17:12:23 +02:00
public enum PlayerModels {
/**
2018-06-22 01:46:10 +02:00
* The default non-pony model. This is typically handled my the vanilla renderer.
*/
2018-06-22 01:46:10 +02:00
DEFAULT("default", "slim", () -> PMAPI.earthpony, () -> PMAPI.earthponySmall),
EARTH("earthpony", "slimearthpony", () -> PMAPI.earthpony, () -> PMAPI.earthponySmall),
PEGASUS("pegasus", "slimpegasus", () -> PMAPI.pegasus, () -> PMAPI.pegasusSmall),
2018-08-25 00:26:09 +02:00
BATPONY("batpony", "slimbatpony", () -> PMAPI.bat, () -> PMAPI.batSmall),
2018-05-11 20:20:10 +02:00
UNICORN("unicorn", "slimunicorn", () -> PMAPI.unicorn, () -> PMAPI.unicornSmall),
2018-04-30 14:10:30 +02:00
ALICORN("alicorn", "slimalicorn", () -> PMAPI.alicorn, () -> PMAPI.alicornSmall),
ZEBRA("zebra", "slimzebra", () -> PMAPI.zebra, () -> PMAPI.zebraSmall),
SEAPONY("seapony", "slimseapony", () -> PMAPI.seapony, () -> PMAPI.seapony) {
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;
PlayerModels(String normalKey, String slimKey, ModelResolver normal, ModelResolver slim) {
this.normalKey = normalKey;
this.slimKey = slimKey;
this.normal = normal;
this.slim = slim;
}
public ModelWrapper getModel(boolean slim) {
return slim ? this.slim.resolve() : normal.resolve();
2018-04-24 17:12:23 +02:00
}
public String getId(boolean useSlimArms) {
return useSlimArms ? slimKey : normalKey;
2018-04-24 17:12:23 +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 {
ModelWrapper resolve();
2018-04-24 17:12:23 +02:00
}
}