Search in sources :

Example 21 with ISkinType

use of riskyken.armourersWorkshop.api.common.skin.type.ISkinType in project Armourers-Workshop by RiskyKen.

the class CommonSkinCache method getFullIdentifier.

public SkinIdentifier getFullIdentifier(Skin skin, ISkinIdentifier skinIdentifier) {
    int localId = skin.lightHash();
    ISkinType skinType = skin.getSkinType();
    ILibraryFile libraryFile = null;
    int globalId = 0;
    try {
        if (cacheLocalFile.containsValue(skin.lightHash())) {
            libraryFile = cacheLocalFile.getBackward(skin.lightHash());
        }
        if (cacheGlobal.containsValue(skin.lightHash())) {
            globalId = cacheGlobal.getBackward(skin.lightHash());
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    return new SkinIdentifier(localId, libraryFile, globalId, skinType);
}
Also used : ISkinType(riskyken.armourersWorkshop.api.common.skin.type.ISkinType) ILibraryFile(riskyken.armourersWorkshop.api.common.library.ILibraryFile) ISkinIdentifier(riskyken.armourersWorkshop.api.common.skin.data.ISkinIdentifier) SkinIdentifier(riskyken.armourersWorkshop.common.skin.data.SkinIdentifier)

Example 22 with ISkinType

use of riskyken.armourersWorkshop.api.common.skin.type.ISkinType in project Armourers-Workshop by RiskyKen.

the class SkinTypeRegistry method onTextureStitchEvent.

@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onTextureStitchEvent(TextureStitchEvent.Pre event) {
    if (event.map.getTextureType() == 1) {
        for (int i = 0; i < skinTypeMap.size(); i++) {
            String registryName = (String) skinTypeMap.keySet().toArray()[i];
            ISkinType skinType = getSkinTypeFromRegistryName(registryName);
            if (skinType != null) {
                skinType.registerIcon(event.map);
            }
        }
    }
}
Also used : ISkinType(riskyken.armourersWorkshop.api.common.skin.type.ISkinType) SubscribeEvent(cpw.mods.fml.common.eventhandler.SubscribeEvent) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Example 23 with ISkinType

use of riskyken.armourersWorkshop.api.common.skin.type.ISkinType in project Armourers-Workshop by RiskyKen.

the class SkinTypeRegistry method getRegisteredSkinTypes.

@Override
public ArrayList<ISkinType> getRegisteredSkinTypes() {
    ArrayList<ISkinType> skinTypes = new ArrayList<ISkinType>();
    for (int i = 0; i < skinTypeMap.size(); i++) {
        String registryName = (String) skinTypeMap.keySet().toArray()[i];
        ISkinType skinType = getSkinTypeFromRegistryName(registryName);
        if (skinType != null) {
            skinTypes.add(skinType);
        }
    }
    return skinTypes;
}
Also used : ISkinType(riskyken.armourersWorkshop.api.common.skin.type.ISkinType) ArrayList(java.util.ArrayList)

Example 24 with ISkinType

use of riskyken.armourersWorkshop.api.common.skin.type.ISkinType in project Armourers-Workshop by RiskyKen.

the class RenderBlockArmourer method renderTileEntityAt.

public void renderTileEntityAt(TileEntityArmourer te, double x, double y, double z, float tickTime) {
    Minecraft mc = Minecraft.getMinecraft();
    mc.mcProfiler.startSection("armourersArmourer");
    float scale = 0.0625F;
    ISkinType skinType = te.getSkinType();
    mc.mcProfiler.startSection("textureBuild");
    if (te.skinTexture == null) {
        te.skinTexture = new SkinTexture();
    }
    PlayerTexture playerTexture = ClientProxy.playerTextureDownloader.getPlayerTexture(te.getTexture());
    if (!playerTexture.isDownloaded()) {
        playerTexture = ClientProxy.playerTextureDownloader.getPlayerTexture(te.getTextureOld());
    }
    te.skinTexture.updateForResourceLocation(playerTexture.getResourceLocation());
    te.skinTexture.updatePaintData(te.getPaintData());
    mc.mcProfiler.endSection();
    GL11.glPushMatrix();
    GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
    GL11.glColor3f(0.77F, 0.77F, 0.77F);
    ModRenderHelper.disableLighting();
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glTranslated(x, y, z);
    if (te.getDirection() != null) {
        switch(te.getDirection()) {
            case EAST:
                GL11.glRotatef(270, 0, 1, 0);
                break;
            case SOUTH:
                GL11.glRotatef(180, 0, 1, 0);
                break;
            case WEST:
                GL11.glRotatef(90, 0, 1, 0);
                break;
            default:
                break;
        }
    }
    GL11.glTranslated(0, te.getHeightOffset(), 0);
    GL11.glScalef(-1, -1, 1);
    GL11.glScalef(16, 16, 16);
    if (skinType != null) {
        mc.mcProfiler.startSection("modelRender");
        boolean hidden = false;
        if (skinType.getVanillaArmourSlotId() != -1) {
            if (SkinProperties.PROP_ARMOUR_OVERRIDE.getValue(te.getSkinProps())) {
                hidden = true;
            }
        }
        GL11.glPolygonOffset(3F, 3F);
        GL11.glEnable(GL11.GL_POLYGON_OFFSET_FILL);
        if (!hidden) {
            long time = System.currentTimeMillis();
            int fadeTime = 1000;
            int fade = (int) (time - playerTexture.getDownloadTime());
            if (playerTexture.isDownloaded() & fade < fadeTime) {
                PlayerTexture oldTexture = te.getTextureOld();
                oldTexture = ClientProxy.playerTextureDownloader.getPlayerTexture(oldTexture);
                bindTexture(oldTexture.getResourceLocation());
                SkinRenderHelper.renderBuildingGuide(skinType, scale, te.isShowOverlay(), te.isShowHelper());
                te.skinTexture.bindTexture();
                ModRenderHelper.enableAlphaBlend();
                GL11.glColor4f(1, 1, 1, fade / 1000F);
                GL11.glPolygonOffset(-6F, -6F);
                SkinRenderHelper.renderBuildingGuide(skinType, scale, te.isShowOverlay(), te.isShowHelper());
                GL11.glPolygonOffset(3F, 3F);
                ModRenderHelper.disableAlphaBlend();
                GL11.glColor4f(1, 1, 1, 1);
            } else {
                te.skinTexture.bindTexture();
                SkinRenderHelper.renderBuildingGuide(skinType, scale, te.isShowOverlay(), te.isShowHelper());
            }
        }
        GL11.glPolygonOffset(-3F, -3F);
        mc.mcProfiler.endSection();
        mc.mcProfiler.startSection("renderGuideGrid");
        SkinRenderHelper.renderBuildingGrid(skinType, scale, te.isShowGuides(), hidden, SkinProperties.PROP_BLOCK_MULTIBLOCK.getValue(te.getSkinProps()));
        mc.mcProfiler.endSection();
        GL11.glPolygonOffset(0F, 0F);
        GL11.glDisable(GL11.GL_POLYGON_OFFSET_FILL);
    }
    GL11.glPopAttrib();
    GL11.glPopMatrix();
    GL11.glColor3f(1F, 1F, 1F);
    ModRenderHelper.enableLighting();
    GL11.glEnable(GL11.GL_LIGHTING);
    mc.mcProfiler.endSection();
}
Also used : ISkinType(riskyken.armourersWorkshop.api.common.skin.type.ISkinType) PlayerTexture(riskyken.armourersWorkshop.client.texture.PlayerTexture) Minecraft(net.minecraft.client.Minecraft) SkinTexture(riskyken.armourersWorkshop.common.skin.data.SkinTexture)

Example 25 with ISkinType

use of riskyken.armourersWorkshop.api.common.skin.type.ISkinType in project Armourers-Workshop by RiskyKen.

the class SkinItemRenderHelper method renderSkinWithHelper.

public static void renderSkinWithHelper(Skin skin, ISkinPointer skinPointer, boolean showSkinPaint, boolean doLodLoading) {
    ISkinType skinType = skinPointer.getIdentifier().getSkinType();
    if (skinType == null) {
        skinType = skin.getSkinType();
    }
    IEquipmentModel targetModel = SkinModelRenderer.INSTANCE.getModelForEquipmentType(skinType);
    if (targetModel == null) {
        renderSkinWithoutHelper(skinPointer, doLodLoading);
        return;
    }
    targetModel.render(null, null, skin, showSkinPaint, skinPointer.getSkinDye(), null, true, 0, doLodLoading);
}
Also used : ISkinType(riskyken.armourersWorkshop.api.common.skin.type.ISkinType) IEquipmentModel(riskyken.armourersWorkshop.client.model.skin.IEquipmentModel)

Aggregations

ISkinType (riskyken.armourersWorkshop.api.common.skin.type.ISkinType)38 SkinPointer (riskyken.armourersWorkshop.common.skin.data.SkinPointer)6 ItemStack (net.minecraft.item.ItemStack)5 SkinIdentifier (riskyken.armourersWorkshop.common.skin.data.SkinIdentifier)5 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)4 GuiButtonExt (cpw.mods.fml.client.config.GuiButtonExt)3 IOException (java.io.IOException)3 ArrayList (java.util.ArrayList)3 Set (java.util.Set)3 Slot (net.minecraft.inventory.Slot)3 Item (net.minecraft.item.Item)3 ILibraryFile (riskyken.armourersWorkshop.api.common.library.ILibraryFile)3 GuiDropDownList (riskyken.armourersWorkshop.client.gui.controls.GuiDropDownList)3 NewerFileVersionException (riskyken.armourersWorkshop.common.exception.NewerFileVersionException)3 Point (java.awt.Point)2 Minecraft (net.minecraft.client.Minecraft)2 ScaledResolution (net.minecraft.client.gui.ScaledResolution)2 TileEntity (net.minecraft.tileentity.TileEntity)2 ForgeDirection (net.minecraftforge.common.util.ForgeDirection)2 ISkinIdentifier (riskyken.armourersWorkshop.api.common.skin.data.ISkinIdentifier)2