mirror of
https://github.com/Sollace/Unicopia.git
synced 2025-02-17 10:24:23 +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;
|
package com.minelittlepony.unicopia;
|
||||||
|
|
||||||
import com.minelittlepony.MineLittlePony;
|
import com.minelittlepony.MineLittlePony;
|
||||||
|
import com.minelittlepony.pony.data.IPony;
|
||||||
import com.minelittlepony.pony.data.PonyRace;
|
import com.minelittlepony.pony.data.PonyRace;
|
||||||
|
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
|
||||||
public final class MineLP {
|
public final class MineLP {
|
||||||
private static boolean checkComplete;
|
private static boolean checkComplete;
|
||||||
private static boolean modIsActive;
|
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.
|
* Returns true if mine little pony is present. That's all we need.
|
||||||
*/
|
*/
|
||||||
public static boolean modIsActive() {
|
static boolean modIsActive() {
|
||||||
if (!checkComplete) {
|
if (!checkComplete) {
|
||||||
try {
|
try {
|
||||||
MineLittlePony.getInstance();
|
MineLittlePony.getInstance();
|
||||||
|
@ -23,4 +26,33 @@ public final class MineLP {
|
||||||
}
|
}
|
||||||
return modIsActive;
|
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 java.util.Map;
|
||||||
|
|
||||||
import com.google.common.base.Strings;
|
import com.google.common.base.Strings;
|
||||||
import com.minelittlepony.pony.data.PonyRace;
|
|
||||||
import com.minelittlepony.unicopia.forgebullshit.FUF;
|
|
||||||
|
|
||||||
public enum Race {
|
public enum Race {
|
||||||
/**
|
/**
|
||||||
|
@ -79,32 +77,6 @@ public enum Race {
|
||||||
return def;
|
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) {
|
public static Race fromName(String name) {
|
||||||
return fromName(name, EARTH);
|
return fromName(name, EARTH);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@ import java.util.UUID;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import com.minelittlepony.jumpingcastle.api.Target;
|
import com.minelittlepony.jumpingcastle.api.Target;
|
||||||
import com.minelittlepony.pony.data.IPony;
|
|
||||||
import com.minelittlepony.unicopia.hud.UHud;
|
import com.minelittlepony.unicopia.hud.UHud;
|
||||||
import com.minelittlepony.unicopia.input.Keyboard;
|
import com.minelittlepony.unicopia.input.Keyboard;
|
||||||
import com.minelittlepony.unicopia.inventory.gui.GuiOfHolding;
|
import com.minelittlepony.unicopia.inventory.gui.GuiOfHolding;
|
||||||
|
@ -47,9 +46,8 @@ public class UnicopiaClient extends UClient {
|
||||||
|
|
||||||
private static Race getclientPlayerRace() {
|
private static Race getclientPlayerRace() {
|
||||||
if (!UConfig.getInstance().ignoresMineLittlePony()
|
if (!UConfig.getInstance().ignoresMineLittlePony()
|
||||||
&& Minecraft.getMinecraft().player != null
|
&& Minecraft.getMinecraft().player != null) {
|
||||||
&& MineLP.modIsActive()) {
|
Race race = MineLP.getPlayerPonyRace();
|
||||||
Race race = Race.fromPonyRace(IPony.forPlayer(Minecraft.getMinecraft().player).getRace(false));
|
|
||||||
|
|
||||||
if (!race.isDefault()) {
|
if (!race.isDefault()) {
|
||||||
return race;
|
return race;
|
||||||
|
|
Loading…
Reference in a new issue