package com.voxelmodpack.hdskins.gui;

import static net.minecraft.client.renderer.GlStateManager.*;

import org.lwjgl.opengl.GL11;

import net.minecraft.client.Minecraft;
import net.minecraft.client.model.ModelPlayer;
import net.minecraft.client.renderer.entity.RenderLivingBase;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.util.ResourceLocation;

public class RenderPlayerModel<M extends EntityPlayerModel> extends RenderLivingBase<M> {

    private static final ModelPlayer FAT = new ModelPlayer(0, false);
    private static final ModelPlayer THIN = new ModelPlayer(0, true);

    public RenderPlayerModel(RenderManager renderer) {
        super(renderer, FAT, 0.0F);
    }

    @Override
    protected ResourceLocation getEntityTexture(M var1) {
        return var1.getSkinTexture();
    }

    @Override
    protected boolean canRenderName(M targetEntity) {
        if (Minecraft.getMinecraft().thePlayer != null) {
            return super.canRenderName(targetEntity);
        }
        return false;
    }

    @Override
    protected boolean setBrightness(M entitylivingbaseIn, float partialTicks, boolean p_177092_3_) {
        if (Minecraft.getMinecraft().theWorld != null) {
            return super.setBrightness(entitylivingbaseIn, partialTicks, p_177092_3_);
        }
        return false;
    }

    @Override
    public void doRender(M par1Entity, double par2, double par4, double par6, float par8, float par9) {
        if (par1Entity.metaHandler != null && par1Entity.metaHandler.get("slim").isPresent()) {
            boolean skinny = "true".equals(par1Entity.metaHandler.get("slim").get());
            this.mainModel = skinny ? THIN : FAT;
        } else {
            this.mainModel = FAT;
        }

        GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
        super.doRender(par1Entity, par2, par4, par6, par8, par9);
        popAttrib();
        pushMatrix();
        scale(1.0F, -1.0F, 1.0F);
        GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
        super.doRender(par1Entity, par2, par4, par6, par8, par9);
        popAttrib();
        popMatrix();
    }

    @Override
    protected void preRenderCallback(M par1EntityLiving, float par2) {
        this.renderCloak(par1EntityLiving, par2);
    }

    protected void renderCloak(M entity, float par2) {
        super.preRenderCallback(entity, par2);
    }
}

@@ -95,16 +95,39 @@
 ger.*;%0A%0A
+import java.util.Set;%0A%0A
 import o
@@ -352,24 +352,81 @@
 derManager;%0A
+import net.minecraft.entity.player.EnumPlayerModelParts;%0A
 import net.m
@@ -1830,24 +1830,742 @@
 %0A        %7D%0A%0A
+        ModelPlayer player = (ModelPlayer) this.getMainModel();%0A%0A        Set%3CEnumPlayerModelParts%3E parts = Minecraft.getMinecraft().gameSettings.getModelParts();%0A        player.bipedHeadwear.isHidden = !parts.contains(EnumPlayerModelParts.HAT);%0A        player.bipedBodyWear.isHidden = !parts.contains(EnumPlayerModelParts.JACKET);%0A        player.bipedLeftLegwear.isHidden = !parts.contains(EnumPlayerModelParts.LEFT_PANTS_LEG);%0A        player.bipedRightLegwear.isHidden = !parts.contains(EnumPlayerModelParts.RIGHT_PANTS_LEG);%0A        player.bipedLeftArmwear.isHidden = !parts.contains(EnumPlayerModelParts.LEFT_SLEEVE);%0A        player.bipedRightArmwear.isHidden = !parts.contains(EnumPlayerModelParts.RIGHT_SLEEVE);%0A%0A
         GL11

make playermodel entity show wears. Maybe release tomorrow.