mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-23 21:38:00 +01:00
Move the minelp code into one location
This commit is contained in:
parent
6f8a2ea72e
commit
5495d75260
3 changed files with 35 additions and 33 deletions
|
@ -1,8 +1,11 @@
|
|||
package com.minelittlepony.unicopia;
|
||||
|
||||
import com.minelittlepony.MineLittlePony;
|
||||
import com.minelittlepony.pony.data.IPony;
|
||||
import com.minelittlepony.pony.data.PonyRace;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
public final class MineLP {
|
||||
private static boolean checkComplete;
|
||||
private static boolean modIsActive;
|
||||
|
@ -10,7 +13,7 @@ public final class MineLP {
|
|||
/**
|
||||
* Returns true if mine little pony is present. That's all we need.
|
||||
*/
|
||||
public static boolean modIsActive() {
|
||||
static boolean modIsActive() {
|
||||
if (!checkComplete) {
|
||||
try {
|
||||
MineLittlePony.getInstance();
|
||||
|
@ -23,4 +26,33 @@ public final class MineLP {
|
|||
}
|
||||
return modIsActive;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -4,8 +4,6 @@ import java.util.HashMap;
|
|||
import java.util.Map;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import com.minelittlepony.pony.data.PonyRace;
|
||||
import com.minelittlepony.unicopia.forgebullshit.FUF;
|
||||
|
||||
public enum Race {
|
||||
/**
|
||||
|
@ -79,32 +77,6 @@ public enum Race {
|
|||
return def;
|
||||
}
|
||||
|
||||
// Commented so we don't alert overlord forge
|
||||
@FUF(reason = "@SideOnly(Side.CLIENT)")
|
||||
public static Race fromPonyRace(PonyRace ponyRace) {
|
||||
switch (ponyRace) {
|
||||
case ALICORN:
|
||||
return ALICORN;
|
||||
case CHANGELING:
|
||||
case REFORMED_CHANGELING:
|
||||
return CHANGELING;
|
||||
case ZEBRA:
|
||||
case EARTH:
|
||||
return EARTH;
|
||||
case GRIFFIN:
|
||||
case HIPPOGRIFF:
|
||||
case PEGASUS:
|
||||
case BATPONY:
|
||||
return PEGASUS;
|
||||
case SEAPONY:
|
||||
case UNICORN:
|
||||
return UNICORN;
|
||||
default:
|
||||
return EARTH;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static Race fromName(String name) {
|
||||
return fromName(name, EARTH);
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@ import java.util.UUID;
|
|||
import javax.annotation.Nullable;
|
||||
|
||||
import com.minelittlepony.jumpingcastle.api.Target;
|
||||
import com.minelittlepony.pony.data.IPony;
|
||||
import com.minelittlepony.unicopia.hud.UHud;
|
||||
import com.minelittlepony.unicopia.input.Keyboard;
|
||||
import com.minelittlepony.unicopia.inventory.gui.GuiOfHolding;
|
||||
|
@ -47,9 +46,8 @@ public class UnicopiaClient extends UClient {
|
|||
|
||||
private static Race getclientPlayerRace() {
|
||||
if (!UConfig.getInstance().ignoresMineLittlePony()
|
||||
&& Minecraft.getMinecraft().player != null
|
||||
&& MineLP.modIsActive()) {
|
||||
Race race = Race.fromPonyRace(IPony.forPlayer(Minecraft.getMinecraft().player).getRace(false));
|
||||
&& Minecraft.getMinecraft().player != null) {
|
||||
Race race = MineLP.getPlayerPonyRace();
|
||||
|
||||
if (!race.isDefault()) {
|
||||
return race;
|
||||
|
|
Loading…
Reference in a new issue