mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-22 20:47:59 +01:00
Can't always rely on Minecraft.getConnection. Mojang pls
This commit is contained in:
parent
871f12c3e2
commit
0f7605edc3
2 changed files with 6 additions and 11 deletions
|
@ -4,7 +4,6 @@ import com.google.common.collect.Lists;
|
|||
import com.google.common.collect.Maps;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonParseException;
|
||||
import com.minelittlepony.ducks.IPlayerInfo;
|
||||
import com.minelittlepony.model.PMAPI;
|
||||
import com.minelittlepony.pony.data.Pony;
|
||||
import com.minelittlepony.pony.data.PonyLevel;
|
||||
|
@ -76,7 +75,12 @@ public class PonyManager implements IResourceManagerReloadListener {
|
|||
* @param player the player
|
||||
*/
|
||||
public Pony getPony(AbstractClientPlayer player) {
|
||||
return getPony(IPlayerInfo.getPlayerInfo(player).unwrap());
|
||||
ResourceLocation skin = player.getLocationSkin();
|
||||
UUID uuid = player.getGameProfile().getId();
|
||||
|
||||
if (skin == null) return getDefaultPony(uuid);
|
||||
|
||||
return getPony(skin, uuid);
|
||||
}
|
||||
|
||||
public Pony getPony(NetworkPlayerInfo playerInfo) {
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package com.minelittlepony.ducks;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.entity.AbstractClientPlayer;
|
||||
import net.minecraft.client.network.NetworkPlayerInfo;
|
||||
|
||||
public interface IPlayerInfo {
|
||||
|
@ -10,13 +8,6 @@ public interface IPlayerInfo {
|
|||
*/
|
||||
boolean usesSlimArms();
|
||||
|
||||
/**
|
||||
* Gets the player info for the given player.
|
||||
*/
|
||||
public static IPlayerInfo getPlayerInfo(AbstractClientPlayer player) {
|
||||
return (IPlayerInfo)Minecraft.getMinecraft().getConnection().getPlayerInfo(player.getUniqueID());
|
||||
}
|
||||
|
||||
default NetworkPlayerInfo unwrap() {
|
||||
return (NetworkPlayerInfo)this;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue