Search in sources :

Example 46 with Skin

use of riskyken.armourersWorkshop.common.skin.data.Skin in project Armourers-Workshop by RiskyKen.

the class SkinCacheLocalFile method doSkinLoading.

public void doSkinLoading() {
    synchronized (cacheMapLock) {
        synchronized (skinLoadQueueLock) {
            if (skinLoadQueue.size() > 0) {
                SkinRequestMessage requestMessage = skinLoadQueue.get(0);
                Skin skin = load(requestMessage.getSkinIdentifier());
                if (skin != null) {
                    CommonSkinCache.INSTANCE.onSkinLoaded(skin, requestMessage);
                }
                skinLoadQueue.remove(0);
            }
        }
    }
}
Also used : Skin(riskyken.armourersWorkshop.common.skin.data.Skin)

Example 47 with Skin

use of riskyken.armourersWorkshop.common.skin.data.Skin in project Armourers-Workshop by RiskyKen.

the class RenderBlockHologramProjector method renderTileEntityAt.

public void renderTileEntityAt(TileEntityHologramProjector tileEntity, double x, double y, double z, float partialTickTime) {
    if (tileEntity.getPowerMode() != PowerMode.IGNORED) {
        if (tileEntity.getPowerMode() == PowerMode.HIGH) {
            if (!tileEntity.isPowered()) {
                return;
            }
        } else {
            if (tileEntity.isPowered()) {
                return;
            }
        }
    }
    ItemStack itemStack = tileEntity.getStackInSlot(0);
    SkinPointer skinPointer = SkinNBTHelper.getSkinPointerFromStack(itemStack);
    if (skinPointer == null) {
        return;
    }
    int rot = tileEntity.getBlockMetadata();
    GL11.glPushMatrix();
    GL11.glEnable(GL11.GL_NORMALIZE);
    GL11.glTranslated(x + 0.5F, y + 0.5D, z + 0.5F);
    GL11.glRotatef(180, 0, 0, 1);
    if (rot == 1) {
        GL11.glRotatef(180, 0, 0, 1);
    }
    if (rot == 2) {
        GL11.glRotatef(90, -1, 0, 0);
    }
    if (rot == 3) {
        GL11.glRotatef(90, 1, 0, 0);
    }
    if (rot == 4) {
        GL11.glRotatef(90, 0, 0, -1);
    }
    if (rot == 5) {
        GL11.glRotatef(90, 0, 0, 1);
    }
    float scale = 0.0625F;
    GL11.glTranslated(tileEntity.getOffsetX() * scale, tileEntity.getOffsetY() * scale, tileEntity.getOffsetZ() * scale);
    GL11.glScalef(-1, -1, 1);
    int speedX = tileEntity.getRotationSpeedX();
    int speedY = tileEntity.getRotationSpeedY();
    int speedZ = tileEntity.getRotationSpeedZ();
    float angleX = 0;
    float angleY = 0;
    float angleZ = 0;
    if (speedX != 0) {
        angleX = (System.currentTimeMillis() % speedX);
        angleX = angleX / speedX * 360F;
    }
    if (speedY != 0) {
        angleY = (System.currentTimeMillis() % speedY);
        angleY = angleY / speedY * 360F;
    }
    if (speedZ != 0) {
        angleZ = (System.currentTimeMillis() % speedZ);
        angleZ = angleZ / speedZ * 360F;
    }
    if (!tileEntity.isGlowing()) {
        ForgeDirection dir = ForgeDirection.getOrientation(tileEntity.getBlockMetadata());
        float xLight = tileEntity.xCoord;
        float yLight = tileEntity.yCoord;
        float zLight = tileEntity.zCoord;
        float offsetX = tileEntity.getOffsetX();
        float offsetY = tileEntity.getOffsetY();
        float offsetZ = tileEntity.getOffsetZ();
        switch(dir) {
            case UP:
                xLight += offsetX * scale;
                yLight += offsetY * scale;
                zLight += offsetZ * scale;
                break;
            case DOWN:
                xLight += -offsetX * scale;
                yLight += -offsetY * scale;
                zLight += offsetZ * scale;
                break;
            case EAST:
                xLight += offsetY * scale;
                yLight += -offsetX * scale;
                zLight += offsetZ * scale;
                break;
            case WEST:
                xLight += -offsetY * scale;
                yLight += offsetX * scale;
                zLight += offsetZ * scale;
                break;
            case NORTH:
                xLight += offsetX * scale;
                yLight += -offsetZ * scale;
                zLight += -offsetY * scale;
                break;
            case SOUTH:
                xLight += -offsetX * scale;
                yLight += offsetY * scale;
                zLight += offsetZ * scale;
                break;
            default:
                break;
        }
        ModRenderHelper.setLightingForBlock(tileEntity.getWorldObj(), (int) (xLight + 0.5F), (int) (yLight + 0.5F), (int) (zLight + 0.5F));
    }
    GL11.glPushMatrix();
    GL11.glTranslated((-tileEntity.getRotationOffsetX() + tileEntity.getRotationOffsetX()) * scale, (-tileEntity.getRotationOffsetY() + tileEntity.getRotationOffsetY()) * scale, (-tileEntity.getRotationOffsetZ() + tileEntity.getRotationOffsetZ()) * scale);
    if (tileEntity.getAngleX() != 0) {
        GL11.glRotatef(tileEntity.getAngleX(), 1F, 0F, 0F);
    }
    if (tileEntity.getAngleY() != 0) {
        GL11.glRotatef(tileEntity.getAngleY(), 0F, 1F, 0F);
    }
    if (tileEntity.getAngleZ() != 0) {
        GL11.glRotatef(tileEntity.getAngleZ(), 0F, 0F, 1F);
    }
    if (angleX != 0) {
        GL11.glRotatef((float) angleX, 1, 0, 0);
    }
    if (angleY != 0) {
        GL11.glRotatef((float) angleY, 0, 1, 0);
    }
    if (angleZ != 0) {
        GL11.glRotatef((float) angleZ, 0, 0, 1);
    }
    GL11.glTranslated(tileEntity.getRotationOffsetX() * scale, tileEntity.getRotationOffsetY() * scale, tileEntity.getRotationOffsetZ() * scale);
    if (tileEntity.isGlowing()) {
        ModRenderHelper.disableLighting();
    }
    ModRenderHelper.enableAlphaBlend();
    Skin skin = ClientSkinCache.INSTANCE.getSkin(skinPointer);
    ItemStackRenderHelper.renderSkinWithHelper(skin, skinPointer, true, false);
    GL11.glPopMatrix();
    if (tileEntity.isShowRotationPoint()) {
        AxisAlignedBB aabb = AxisAlignedBB.getBoundingBox(0, 0, 0, scale, scale, scale);
        renderBox(aabb, 1F, 0F, 1F);
    }
    ModRenderHelper.disableAlphaBlend();
    if (tileEntity.isGlowing()) {
        ModRenderHelper.enableLighting();
    }
    GL11.glDisable(GL11.GL_NORMALIZE);
    GL11.glPopMatrix();
}
Also used : AxisAlignedBB(net.minecraft.util.AxisAlignedBB) SkinPointer(riskyken.armourersWorkshop.common.skin.data.SkinPointer) ForgeDirection(net.minecraftforge.common.util.ForgeDirection) Skin(riskyken.armourersWorkshop.common.skin.data.Skin) ItemStack(net.minecraft.item.ItemStack)

Example 48 with Skin

use of riskyken.armourersWorkshop.common.skin.data.Skin in project Armourers-Workshop by RiskyKen.

the class RenderBlockMannequin method hasCustomHead.

private boolean hasCustomHead(IInventory inventory) {
    ItemStack stack = getStackInMannequinSlot(inventory, MannequinSlotType.HEAD);
    if (stack != null) {
        if (stack.getItem() instanceof ItemBlock) {
            return true;
        }
    }
    if (isHalloweenSeason) {
        return true;
    }
    SkinPointer skinPointer = SkinNBTHelper.getSkinPointerFromStack(stack);
    if (skinPointer != null) {
        Skin skin = ClientSkinCache.INSTANCE.getSkin(skinPointer, false);
        if (skin != null) {
            return SkinProperties.PROP_ARMOUR_OVERRIDE.getValue(skin.getProperties());
        }
    }
    return false;
}
Also used : SkinPointer(riskyken.armourersWorkshop.common.skin.data.SkinPointer) ISkinPointer(riskyken.armourersWorkshop.api.common.skin.data.ISkinPointer) Skin(riskyken.armourersWorkshop.common.skin.data.Skin) ItemStack(net.minecraft.item.ItemStack) ItemBlock(net.minecraft.item.ItemBlock)

Example 49 with Skin

use of riskyken.armourersWorkshop.common.skin.data.Skin in project Armourers-Workshop by RiskyKen.

the class SkinItemRenderHelper method renderSkinWithoutHelper.

public static void renderSkinWithoutHelper(ISkinPointer skinPointer, boolean doLodLoading) {
    Skin skin = ClientSkinCache.INSTANCE.getSkin(skinPointer);
    if (skin == null) {
        return;
    }
    float scale = 1F / 16F;
    for (int i = 0; i < skin.getParts().size(); i++) {
        GL11.glPushMatrix();
        SkinPart skinPart = skin.getParts().get(i);
        IPoint3D offset = skinPart.getPartType().getOffset();
        GL11.glTranslated(offset.getX() * scale, (offset.getY() + 1) * scale, offset.getZ() * scale);
        SkinPartRenderer.INSTANCE.renderPart(skinPart, 0.0625F, skinPointer.getSkinDye(), null, doLodLoading);
        GL11.glPopMatrix();
    }
}
Also used : IPoint3D(riskyken.armourersWorkshop.api.common.IPoint3D) Skin(riskyken.armourersWorkshop.common.skin.data.Skin) SkinPart(riskyken.armourersWorkshop.common.skin.data.SkinPart)

Example 50 with Skin

use of riskyken.armourersWorkshop.common.skin.data.Skin in project Armourers-Workshop by RiskyKen.

the class SkinModelRenderer method renderEquipmentPartFromStack.

public boolean renderEquipmentPartFromStack(ItemStack stack, ModelBiped modelBiped, byte[] extraColours, double distance, boolean doLodLoading) {
    SkinPointer skinPointer = SkinNBTHelper.getSkinPointerFromStack(stack);
    if (skinPointer == null) {
        return false;
    }
    Skin data = getCustomArmourItemData(skinPointer);
    return renderEquipmentPart(null, modelBiped, data, skinPointer.getSkinDye(), extraColours, distance, doLodLoading);
}
Also used : SkinPointer(riskyken.armourersWorkshop.common.skin.data.SkinPointer) ISkinPointer(riskyken.armourersWorkshop.api.common.skin.data.ISkinPointer) Skin(riskyken.armourersWorkshop.common.skin.data.Skin) AbstractModelSkin(riskyken.armourersWorkshop.client.model.skin.AbstractModelSkin)

Aggregations

Skin (riskyken.armourersWorkshop.common.skin.data.Skin)69 SkinPointer (riskyken.armourersWorkshop.common.skin.data.SkinPointer)19 ItemStack (net.minecraft.item.ItemStack)11 ISkinPointer (riskyken.armourersWorkshop.api.common.skin.data.ISkinPointer)11 LibraryFile (riskyken.armourersWorkshop.common.library.LibraryFile)10 SkinIdentifier (riskyken.armourersWorkshop.common.skin.data.SkinIdentifier)10 SkinPart (riskyken.armourersWorkshop.common.skin.data.SkinPart)10 ForgeDirection (net.minecraftforge.common.util.ForgeDirection)9 IOException (java.io.IOException)6 ISkinIdentifier (riskyken.armourersWorkshop.api.common.skin.data.ISkinIdentifier)6 AbstractModelSkin (riskyken.armourersWorkshop.client.model.skin.AbstractModelSkin)6 ItemSkin (riskyken.armourersWorkshop.common.items.ItemSkin)6 Color (java.awt.Color)4 ByteArrayInputStream (java.io.ByteArrayInputStream)4 DataInputStream (java.io.DataInputStream)4 AbstractClientPlayer (net.minecraft.client.entity.AbstractClientPlayer)4 BakedSkin (riskyken.armourersWorkshop.client.model.bake.ModelBakery.BakedSkin)4 SideOnly (cpw.mods.fml.relauncher.SideOnly)3 BufferedInputStream (java.io.BufferedInputStream)3 ArrayList (java.util.ArrayList)3