Files
MCCustomSkinLoader/Vanilla/net/minecraft/client/gui/spectator/PlayerMenuObject.java
T
2018-05-06 01:10:55 +08:00

54 lines
2.0 KiB
Java

package net.minecraft.client.gui.spectator;
import com.mojang.authlib.GameProfile;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.AbstractClientPlayer;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.network.play.client.CPacketSpectate;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentString;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class PlayerMenuObject implements ISpectatorMenuObject
{
private final GameProfile profile;
private final ResourceLocation resourceLocation;
public PlayerMenuObject(GameProfile profileIn)
{
this.profile = profileIn;
/*
this.resourceLocation = AbstractClientPlayer.getLocationSkin(profileIn.getName());
AbstractClientPlayer.getDownloadImageSkin(this.resourceLocation, profileIn.getName());
*/
this.resourceLocation = customskinloader.fake.FakeClientPlayer.getLocationSkin(profileIn.getName());
customskinloader.fake.FakeClientPlayer.getDownloadImageSkin(this.resourceLocation, profileIn.getName());
}
public void selectItem(SpectatorMenu menu)
{
Minecraft.getMinecraft().getConnection().sendPacket(new CPacketSpectate(this.profile.getId()));
}
public ITextComponent getSpectatorName()
{
return new TextComponentString(this.profile.getName());
}
public void renderIcon(float brightness, int alpha)
{
Minecraft.getMinecraft().getTextureManager().bindTexture(this.resourceLocation);
GlStateManager.color(1.0F, 1.0F, 1.0F, (float)alpha / 255.0F);
Gui.drawScaledCustomSizeModalRect(2, 2, 8.0F, 8.0F, 8, 8, 12, 12, 64.0F, 64.0F);
Gui.drawScaledCustomSizeModalRect(2, 2, 40.0F, 8.0F, 8, 8, 12, 12, 64.0F, 64.0F);
}
public boolean isEnabled()
{
return true;
}
}