Search in sources :

Example 1 with PaintType

use of riskyken.armourersWorkshop.common.painting.PaintType in project Armourers-Workshop by RiskyKen.

the class GuiColourMixer method updateColour.

private void updateColour() {
    Color colourOld = new Color(tileEntityColourMixer.getColour(0));
    PaintType paintType = PaintType.values()[paintTypeDropDown.getListSelectedIndex()];
    if (this.colour.equals(colourOld)) {
        if (paintType == tileEntityColourMixer.getPaintType(0))
            return;
    }
    MessageClientGuiColourUpdate message = new MessageClientGuiColourUpdate(this.colour.getRGB(), false, paintType);
    PacketHandler.networkWrapper.sendToServer(message);
}
Also used : MessageClientGuiColourUpdate(riskyken.armourersWorkshop.common.network.messages.client.MessageClientGuiColourUpdate) Color(java.awt.Color) PaintType(riskyken.armourersWorkshop.common.painting.PaintType)

Example 2 with PaintType

use of riskyken.armourersWorkshop.common.painting.PaintType in project Armourers-Workshop by RiskyKen.

the class EntityTextureInfo method applySkinsToTexture.

private void applySkinsToTexture() {
    for (int i = 0; i < skins.length; i++) {
        Skin skin = skins[i];
        if (skin != null && skin.hasPaintData()) {
            for (int ix = 0; ix < textureWidth; ix++) {
                for (int iy = 0; iy < textureHeight; iy++) {
                    int paintColour = skin.getPaintData()[ix + (iy * textureWidth)];
                    PaintType paintType = PaintType.getPaintTypeFromColour(paintColour);
                    if (paintType == PaintType.NORMAL) {
                        bufferedEntitySkinnedImage.setRGB(ix, iy, BitwiseUtils.setUByteToInt(paintColour, 0, 255));
                    }
                    if (paintType == PaintType.HAIR) {
                        int colour = dyeColour(lastEntityHairColour, paintColour, 9, skin);
                        bufferedEntitySkinnedImage.setRGB(ix, iy, colour);
                    }
                    if (paintType == PaintType.SKIN) {
                        int colour = dyeColour(lastEntitySkinColour, paintColour, 8, skin);
                        bufferedEntitySkinnedImage.setRGB(ix, iy, colour);
                    }
                    if (paintType.getKey() >= 1 && paintType.getKey() <= 8) {
                        int dyeNumber = paintType.getKey() - 1;
                        if (dyes != null && dyes[i] != null && dyes[i].haveDyeInSlot(dyeNumber)) {
                            byte[] dye = dyes[i].getDyeColour(dyeNumber);
                            int colour = dyeColour(dye, paintColour, dyeNumber, skin);
                            bufferedEntitySkinnedImage.setRGB(ix, iy, colour);
                        } else {
                            bufferedEntitySkinnedImage.setRGB(ix, iy, BitwiseUtils.setUByteToInt(paintColour, 0, 255));
                        }
                    }
                }
            }
        }
    }
    for (int i = 0; i < skins.length; i++) {
        Skin skin = skins[i];
        if (skin != null && SkinProperties.PROP_ARMOUR_OVERRIDE.getValue(skin.getProperties())) {
            for (int j = 0; j < skin.getPartCount(); j++) {
                SkinPart skinPart = skin.getParts().get(j);
                if (skinPart.getPartType() instanceof ISkinPartTypeTextured) {
                    ISkinPartTypeTextured typeTextured = (ISkinPartTypeTextured) skinPart.getPartType();
                    Point texLoc = typeTextured.getTextureLocation();
                    IPoint3D texSize = typeTextured.getTextureModelSize();
                    for (int ix = 0; ix < texSize.getZ() * 2 + texSize.getX() * 2; ix++) {
                        for (int iy = 0; iy < texSize.getZ() + texSize.getY(); iy++) {
                            if (skin.getSkinType() == SkinTypeRegistry.skinLegs) {
                                if (iy >= 12) {
                                    continue;
                                }
                                if (iy < 4 & ix > 7 & ix < 12) {
                                    continue;
                                }
                            }
                            if (skin.getSkinType() == SkinTypeRegistry.skinFeet) {
                                if (iy < 12) {
                                    if (!(iy < 4 & ix > 7 & ix < 12)) {
                                        continue;
                                    }
                                }
                            }
                            bufferedEntitySkinnedImage.setRGB((int) texLoc.getX() + ix, (int) texLoc.getY() + iy, 0x00FFFFFF);
                        }
                    }
                }
            }
        }
    }
}
Also used : IPoint3D(riskyken.armourersWorkshop.api.common.IPoint3D) Skin(riskyken.armourersWorkshop.common.skin.data.Skin) PaintType(riskyken.armourersWorkshop.common.painting.PaintType) ISkinPartTypeTextured(riskyken.armourersWorkshop.api.common.skin.type.ISkinPartTypeTextured) Point(java.awt.Point) SkinPart(riskyken.armourersWorkshop.common.skin.data.SkinPart) Point(java.awt.Point)

Example 3 with PaintType

use of riskyken.armourersWorkshop.common.painting.PaintType in project Armourers-Workshop by RiskyKen.

the class SkinTexture method applyPaintToTexture.

private void applyPaintToTexture() {
    for (int ix = 0; ix < TEXTURE_WIDTH; ix++) {
        for (int iy = 0; iy < TEXTURE_HEIGHT; iy++) {
            int paintColour = paintData[ix + (iy * TEXTURE_WIDTH)];
            PaintType paintType = PaintType.getPaintTypeFromColour(paintColour);
            if (paintType != PaintType.NONE) {
                bufferedSkinImage.setRGB(ix, iy, BitwiseUtils.setUByteToInt(paintColour, 0, 255));
            }
        }
    }
}
Also used : PaintType(riskyken.armourersWorkshop.common.painting.PaintType)

Example 4 with PaintType

use of riskyken.armourersWorkshop.common.painting.PaintType in project Armourers-Workshop by RiskyKen.

the class RenderBlockColourable method renderTileEntityAt.

public void renderTileEntityAt(TileEntityColourable tileEntity, double x, double y, double z, float partialTickTime) {
    ICubeColour cubeColour = tileEntity.getColour();
    // ModRenderHelper.disableLighting();
    GL11.glDisable(GL11.GL_LIGHTING);
    ModRenderHelper.enableAlphaBlend();
    renderer.startDrawingQuads();
    renderer.setColourRGBA_F(0.7F, 0.7F, 0.7F, markerAlpha);
    if (markerAlpha > 0F) {
        for (int i = 0; i < 6; i++) {
            ForgeDirection dir = ForgeDirection.getOrientation(i);
            int paintType = cubeColour.getPaintType(i) & 0xFF;
            if (paintType != 255) {
                bindTexture(MARKERS);
                GL11.glColor3f(0.77F, 0.77F, 0.77F);
                PaintType pt = PaintType.getPaintTypeFromUKey(paintType);
                renderFaceWithMarker(x, y, z, dir, pt.ordinal());
            }
        }
    }
    renderer.draw();
    GL11.glColor4f(1F, 1F, 1F, 1F);
    ModRenderHelper.disableAlphaBlend();
    ModRenderHelper.enableLighting();
    RenderHelper.enableStandardItemLighting();
}
Also used : ICubeColour(riskyken.armourersWorkshop.api.common.skin.cubes.ICubeColour) ForgeDirection(net.minecraftforge.common.util.ForgeDirection) PaintType(riskyken.armourersWorkshop.common.painting.PaintType)

Example 5 with PaintType

use of riskyken.armourersWorkshop.common.painting.PaintType in project Armourers-Workshop by RiskyKen.

the class ItemColourNoiseTool method usedOnBlockSide.

@SuppressWarnings("deprecation")
@Override
public void usedOnBlockSide(ItemStack stack, EntityPlayer player, World world, BlockLocation bl, Block block, int side) {
    int intensity = UtilItems.getIntensityFromStack(stack, 16);
    IPantableBlock worldColourable = (IPantableBlock) block;
    if (worldColourable.isRemoteOnly(world, bl.x, bl.y, bl.z, side) & world.isRemote) {
        byte[] rgbt = new byte[4];
        int oldColour = worldColourable.getColour(world, bl.x, bl.y, bl.z, side);
        PaintType oldPaintType = worldColourable.getPaintType(world, bl.x, bl.y, bl.z, side);
        Color c = UtilColour.addColourNoise(new Color(oldColour), intensity);
        rgbt[0] = (byte) c.getRed();
        rgbt[1] = (byte) c.getGreen();
        rgbt[2] = (byte) c.getBlue();
        rgbt[3] = (byte) oldPaintType.getKey();
        if (block == ModBlocks.boundingBox && oldPaintType == PaintType.NONE) {
            rgbt[3] = (byte) PaintType.NORMAL.getKey();
        }
        MessageClientToolPaintBlock message = new MessageClientToolPaintBlock(bl.x, bl.y, bl.z, (byte) side, rgbt);
        PacketHandler.networkWrapper.sendToServer(message);
    } else if (!worldColourable.isRemoteOnly(world, bl.x, bl.y, bl.z, side) & !world.isRemote) {
        int oldColour = worldColourable.getColour(world, bl.x, bl.y, bl.z, side);
        byte oldPaintType = (byte) worldColourable.getPaintType(world, bl.x, bl.y, bl.z, side).getKey();
        int newColour = UtilColour.addColourNoise(new Color(oldColour), intensity).getRGB();
        UndoManager.blockPainted(player, world, bl.x, bl.y, bl.z, oldColour, oldPaintType, side);
        ((IPantableBlock) block).setColour(world, bl.x, bl.y, bl.z, newColour, side);
    }
}
Also used : Color(java.awt.Color) MessageClientToolPaintBlock(riskyken.armourersWorkshop.common.network.messages.client.MessageClientToolPaintBlock) PaintType(riskyken.armourersWorkshop.common.painting.PaintType) IPantableBlock(riskyken.armourersWorkshop.api.common.painting.IPantableBlock)

Aggregations

PaintType (riskyken.armourersWorkshop.common.painting.PaintType)24 Color (java.awt.Color)12 IPantableBlock (riskyken.armourersWorkshop.api.common.painting.IPantableBlock)12 Block (net.minecraft.block.Block)6 MessageClientToolPaintBlock (riskyken.armourersWorkshop.common.network.messages.client.MessageClientToolPaintBlock)6 TileEntity (net.minecraft.tileentity.TileEntity)5 IPantable (riskyken.armourersWorkshop.api.common.painting.IPantable)5 TileEntityArmourer (riskyken.armourersWorkshop.common.tileentities.TileEntityArmourer)3 ForgeDirection (net.minecraftforge.common.util.ForgeDirection)2 ISkinPartTypeTextured (riskyken.armourersWorkshop.api.common.skin.type.ISkinPartTypeTextured)2 BlockLocation (riskyken.armourersWorkshop.common.blocks.BlockLocation)2 Point (java.awt.Point)1 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)1 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)1 World (net.minecraft.world.World)1 IPoint3D (riskyken.armourersWorkshop.api.common.IPoint3D)1 ICubeColour (riskyken.armourersWorkshop.api.common.skin.cubes.ICubeColour)1 BlockMannequin (riskyken.armourersWorkshop.common.blocks.BlockMannequin)1 MessageClientGuiColourUpdate (riskyken.armourersWorkshop.common.network.messages.client.MessageClientGuiColourUpdate)1 MessageClientGuiToolOptionUpdate (riskyken.armourersWorkshop.common.network.messages.client.MessageClientGuiToolOptionUpdate)1