2018-09-24 21:37:50 +02:00
|
|
|
package com.minelittlepony.unicopia;
|
|
|
|
|
|
|
|
import com.minelittlepony.MineLittlePony;
|
2019-02-02 12:23:22 +01:00
|
|
|
import com.minelittlepony.pony.data.IPony;
|
2019-02-01 21:28:28 +01:00
|
|
|
import com.minelittlepony.pony.data.PonyRace;
|
2018-09-24 21:37:50 +02:00
|
|
|
|
2019-02-02 12:23:22 +01:00
|
|
|
import net.minecraft.client.Minecraft;
|
|
|
|
|
2018-09-24 21:37:50 +02:00
|
|
|
public final class MineLP {
|
|
|
|
private static boolean checkComplete;
|
|
|
|
private static boolean modIsActive;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true if mine little pony is present. That's all we need.
|
|
|
|
*/
|
2019-02-02 12:23:22 +01:00
|
|
|
static boolean modIsActive() {
|
2018-09-24 21:37:50 +02:00
|
|
|
if (!checkComplete) {
|
|
|
|
try {
|
2019-01-08 09:34:05 +01:00
|
|
|
MineLittlePony.getInstance();
|
2019-02-01 21:28:28 +01:00
|
|
|
|
|
|
|
// always true, but this will throw if we don't have what we need.
|
|
|
|
modIsActive = PonyRace.HUMAN.isHuman();
|
2018-09-24 21:37:50 +02:00
|
|
|
} catch (Exception e) {
|
|
|
|
modIsActive = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return modIsActive;
|
|
|
|
}
|
2019-02-02 12:23:22 +01:00
|
|
|
|
|
|
|
public static Race getPlayerPonyRace() {
|
|
|
|
|
|
|
|
if (!modIsActive()) {
|
|
|
|
return Race.HUMAN;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (IPony.forPlayer(Minecraft.getMinecraft().player).getRace(false)) {
|
|
|
|
case ALICORN:
|
|
|
|
return Race.ALICORN;
|
|
|
|
case CHANGELING:
|
|
|
|
case REFORMED_CHANGELING:
|
|
|
|
return Race.CHANGELING;
|
|
|
|
case ZEBRA:
|
|
|
|
case EARTH:
|
|
|
|
return Race.EARTH;
|
|
|
|
case GRIFFIN:
|
|
|
|
case HIPPOGRIFF:
|
|
|
|
case PEGASUS:
|
|
|
|
case BATPONY:
|
|
|
|
return Race.PEGASUS;
|
|
|
|
case SEAPONY:
|
|
|
|
case UNICORN:
|
|
|
|
return Race.UNICORN;
|
|
|
|
default:
|
|
|
|
return Race.EARTH;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
2018-09-24 21:37:50 +02:00
|
|
|
}
|