Search in sources :

Example 1 with AbstractModelSkin

use of riskyken.armourersWorkshop.client.model.skin.AbstractModelSkin in project Armourers-Workshop by RiskyKen.

the class SkinnableEntityZombieRenderer method renderEquipmentType.

private void renderEquipmentType(EntityLivingBase entity, RendererLivingEntity renderer, ISkinType skinType, IEntityEquipment equipmentData) {
    float scale = 0.0625F;
    if (renderer instanceof RenderZombie) {
        RenderZombie rz = (RenderZombie) renderer;
        boolean isZombieVillager = false;
        isZombieVillager = rz.modelBipedMain instanceof ModelZombieVillager;
        if (!equipmentData.haveEquipment(skinType, 0)) {
            return;
        }
        ISkinPointer skinPointer = equipmentData.getSkinPointer(skinType, 0);
        Skin skin = ClientSkinCache.INSTANCE.getSkin(skinPointer);
        if (skin == null) {
            return;
        }
        AbstractModelSkin model = SkinModelRenderer.INSTANCE.getModelForEquipmentType(skinType);
        GL11.glPushMatrix();
        if (isZombieVillager & skinType == SkinTypeRegistry.skinHead) {
            GL11.glTranslated(0, -2.0F * scale, 0);
        }
        if (skinType == SkinTypeRegistry.skinLegs | skinType == SkinTypeRegistry.skinFeet) {
            GL11.glTranslated(0, 0, 0.1F * scale);
        }
        // GL11.glEnable(GL11.GL_POLYGON_OFFSET_FILL);
        // GL11.glPolygonOffset(-1F, -1F);
        model.render(entity, rz.modelBipedMain, skin, false, skinPointer.getSkinDye(), null, false, 0, false);
        // GL11.glDisable(GL11.GL_POLYGON_OFFSET_FILL);
        GL11.glPopMatrix();
    }
}
Also used : RenderZombie(net.minecraft.client.renderer.entity.RenderZombie) AbstractModelSkin(riskyken.armourersWorkshop.client.model.skin.AbstractModelSkin) Skin(riskyken.armourersWorkshop.common.skin.data.Skin) AbstractModelSkin(riskyken.armourersWorkshop.client.model.skin.AbstractModelSkin) ModelZombieVillager(net.minecraft.client.model.ModelZombieVillager) ISkinPointer(riskyken.armourersWorkshop.api.common.skin.data.ISkinPointer)

Example 2 with AbstractModelSkin

use of riskyken.armourersWorkshop.client.model.skin.AbstractModelSkin in project Armourers-Workshop by RiskyKen.

the class AbstractModItemArmour method getArmorModel.

@Override
@SideOnly(Side.CLIENT)
public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack stack, int armorSlot) {
    if (!SkinNBTHelper.stackHasSkinData(stack)) {
        return null;
    }
    SkinPointer skinData = SkinNBTHelper.getSkinPointerFromStack(stack);
    AbstractModelSkin targetModel = null;
    SkinModelRenderer emr = SkinModelRenderer.INSTANCE;
    Skin data = emr.getCustomArmourItemData(skinData);
    if (data == null) {
        return null;
    }
    targetModel = emr.getModelForEquipmentType(data.getSkinType());
    if (targetModel == null) {
        return null;
    }
    targetModel.npcSkinData = data;
    targetModel.npcDyeData = skinData.getSkinDye();
    return targetModel;
}
Also used : SkinModelRenderer(riskyken.armourersWorkshop.client.render.SkinModelRenderer) SkinPointer(riskyken.armourersWorkshop.common.skin.data.SkinPointer) AbstractModelSkin(riskyken.armourersWorkshop.client.model.skin.AbstractModelSkin) Skin(riskyken.armourersWorkshop.common.skin.data.Skin) AbstractModelSkin(riskyken.armourersWorkshop.client.model.skin.AbstractModelSkin) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Example 3 with AbstractModelSkin

use of riskyken.armourersWorkshop.client.model.skin.AbstractModelSkin in project Armourers-Workshop by RiskyKen.

the class SkinnableEntitySkeletonRenderer method renderEquipmentType.

private void renderEquipmentType(EntityLivingBase entity, RendererLivingEntity renderer, ISkinType skinType, IEntityEquipment equipmentData) {
    float scale = 0.0625F;
    if (renderer instanceof RenderSkeleton) {
        RenderSkeleton rs = (RenderSkeleton) renderer;
        if (!equipmentData.haveEquipment(skinType, 0)) {
            return;
        }
        ISkinPointer skinPointer = equipmentData.getSkinPointer(skinType, 0);
        Skin skin = ClientSkinCache.INSTANCE.getSkin(skinPointer);
        if (skin == null) {
            return;
        }
        AbstractModelSkin model = SkinModelRenderer.INSTANCE.getModelForEquipmentType(skinType);
        GL11.glPushMatrix();
        model.render(entity, rs.modelBipedMain, skin, false, skinPointer.getSkinDye(), null, false, 0, false);
        GL11.glPopMatrix();
    }
}
Also used : RenderSkeleton(net.minecraft.client.renderer.entity.RenderSkeleton) AbstractModelSkin(riskyken.armourersWorkshop.client.model.skin.AbstractModelSkin) Skin(riskyken.armourersWorkshop.common.skin.data.Skin) AbstractModelSkin(riskyken.armourersWorkshop.client.model.skin.AbstractModelSkin) ISkinPointer(riskyken.armourersWorkshop.api.common.skin.data.ISkinPointer)

Aggregations

AbstractModelSkin (riskyken.armourersWorkshop.client.model.skin.AbstractModelSkin)3 Skin (riskyken.armourersWorkshop.common.skin.data.Skin)3 ISkinPointer (riskyken.armourersWorkshop.api.common.skin.data.ISkinPointer)2 SideOnly (cpw.mods.fml.relauncher.SideOnly)1 ModelZombieVillager (net.minecraft.client.model.ModelZombieVillager)1 RenderSkeleton (net.minecraft.client.renderer.entity.RenderSkeleton)1 RenderZombie (net.minecraft.client.renderer.entity.RenderZombie)1 SkinModelRenderer (riskyken.armourersWorkshop.client.render.SkinModelRenderer)1 SkinPointer (riskyken.armourersWorkshop.common.skin.data.SkinPointer)1