Can't always rely on Minecraft.getConnection. Mojang pls

This commit is contained in:
Sollace 2018-04-29 20:19:30 +02:00
parent 871f12c3e2
commit 0f7605edc3
2 changed files with 6 additions and 11 deletions

View file

@ -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) {

View file

@ -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;
}