Added SkinProvider to provide loaded Skins for loaded Players in a Replay
Uses SkinProvider in GuiPlayerOverview instead of requesting the Skin from the Mojang API
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
package eu.crushedpixel.replaymod.utils;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.network.NetworkPlayerInfo;
|
||||
import net.minecraft.client.resources.DefaultPlayerSkin;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class SkinProvider {
|
||||
|
||||
public static ResourceLocation getResourceLocationForPlayerUUID(UUID uuid) {
|
||||
NetworkPlayerInfo info = Minecraft.getMinecraft().getNetHandler().getPlayerInfo(uuid);
|
||||
ResourceLocation skinLocation;
|
||||
if(info.hasLocationSkin()) {
|
||||
skinLocation = info.getLocationSkin();
|
||||
} else {
|
||||
skinLocation = DefaultPlayerSkin.getDefaultSkin(uuid);
|
||||
}
|
||||
return skinLocation;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user