MineLittlePony/src/main/java/com/minelittlepony/model/part/PonySnout.java

91 lines
5 KiB
Java
Raw Normal View History

2016-11-17 05:45:04 +01:00
package com.minelittlepony.model.part;
import java.util.Map;
import com.google.common.collect.ImmutableMap;
2016-11-17 05:45:04 +01:00
import com.minelittlepony.MineLittlePony;
import com.minelittlepony.PonyData;
import com.minelittlepony.PonyGender;
import com.minelittlepony.model.AbstractPonyModel;
import com.minelittlepony.model.PonyModelConstants;
import com.minelittlepony.renderer.PlaneRenderer;
public class PonySnout extends AbstractHeadPart implements PonyModelConstants {
2016-01-26 09:20:12 +01:00
private static final Map<PonyGender, PlaneRenderer[]> MUZZLES = ImmutableMap.<PonyGender, PlaneRenderer[]> builder()
.put(PonyGender.MARE, new PlaneRenderer[10])
.put(PonyGender.STALLION, new PlaneRenderer[5])
.build();
2016-04-09 08:24:15 +02:00
public PonySnout(AbstractPonyModel pony) {
super(pony);
}
@Override
2016-04-09 08:24:15 +02:00
public void init(float yOffset, float stretch) {
2016-01-26 09:20:12 +01:00
PlaneRenderer[] muzzle = MUZZLES.get(PonyGender.MARE);
muzzle[0] = new PlaneRenderer(pony, 10, 14);
muzzle[1] = new PlaneRenderer(pony, 11, 13);
muzzle[2] = new PlaneRenderer(pony, 9, 14);
muzzle[3] = new PlaneRenderer(pony, 14, 14);
muzzle[4] = new PlaneRenderer(pony, 11, 12);
muzzle[5] = new PlaneRenderer(pony, 18, 7);
muzzle[6] = new PlaneRenderer(pony, 9, 14);
muzzle[7] = new PlaneRenderer(pony, 14, 14);
muzzle[8] = new PlaneRenderer(pony, 11, 12);
muzzle[9] = new PlaneRenderer(pony, 12, 12);
muzzle[0].addBackPlane(-2.0F + HEAD_CENTRE_X, 2.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 4, 2, 0, stretch);
muzzle[0].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
muzzle[1].addBackPlane(-1.0F + HEAD_CENTRE_X, 1.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 2, 1, 0, stretch);
muzzle[1].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
muzzle[2].addTopPlane(-2.0F + HEAD_CENTRE_X, 2.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 1, 0, 1, stretch);
muzzle[2].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
muzzle[3].addTopPlane(1.0F + HEAD_CENTRE_X, 2.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 1, 0, 1, stretch);
muzzle[3].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
muzzle[4].addTopPlane(-1.0F + HEAD_CENTRE_X, 1.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 2, 0, 1, stretch);
muzzle[4].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
muzzle[5].addBottomPlane(-2.0F + HEAD_CENTRE_X, 4.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 4, 0, 1, stretch);
muzzle[5].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
muzzle[6].addWestPlane(-2.0F + HEAD_CENTRE_X, 2.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 0, 2, 1, stretch);
muzzle[6].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
muzzle[7].addEastPlane(2.0F + HEAD_CENTRE_X, 2.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 0, 2, 1, stretch);
muzzle[7].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
muzzle[8].addWestPlane(-1.0F + HEAD_CENTRE_X, 1.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 0, 1, 1, stretch);
muzzle[8].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
muzzle[9].addEastPlane(1.0F + HEAD_CENTRE_X, 1.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 0, 1, 1, stretch);
muzzle[9].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
2016-01-26 09:20:12 +01:00
muzzle = MUZZLES.get(PonyGender.STALLION);
muzzle[0] = new PlaneRenderer(pony, 10, 13);
muzzle[1] = new PlaneRenderer(pony, 10, 13);
muzzle[2] = new PlaneRenderer(pony, 18, 7);
muzzle[3] = new PlaneRenderer(pony, 10, 13);
muzzle[4] = new PlaneRenderer(pony, 13, 13);
muzzle[0].addBackPlane(-2.0F + HEAD_CENTRE_X, 1.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 4, 3, 0, stretch);
muzzle[0].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
muzzle[1].addTopPlane(-2.0F + HEAD_CENTRE_X, 1.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 4, 0, 1, stretch);
muzzle[1].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
muzzle[2].addBottomPlane(-2.0F + HEAD_CENTRE_X, 4.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 4, 0, 1, stretch);
muzzle[2].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
muzzle[3].addWestPlane(-2.0F + HEAD_CENTRE_X, 1.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 0, 3, 1, stretch);
muzzle[3].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
muzzle[4].addEastPlane(2.0F + HEAD_CENTRE_X, 1.0F + HEAD_CENTRE_Y, -5.0F + HEAD_CENTRE_Z, 0, 3, 1, stretch);
muzzle[4].setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
}
@Override
public void render(PonyData data, float scale) {
super.render(data, scale);
2016-01-26 09:16:11 +01:00
if (MineLittlePony.getConfig().snuzzles && data.getGender() != null) {
2016-01-26 09:20:12 +01:00
PlaneRenderer[] muzzle = MUZZLES.get(data.getGender());
for (int i = 0; i < muzzle.length; i++) {
muzzle[i].render(scale);
}
}
}
}