Search in sources :

Example 21 with PaintType

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

the class ItemShadeNoiseTool 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.addShadeNoise(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.addShadeNoise(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)

Example 22 with PaintType

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

the class ItemDyeBottle method onItemUse.

@Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) {
    Block block = world.getBlock(x, y, z);
    if (player.isSneaking() & block == ModBlocks.colourMixer) {
        TileEntity te = world.getTileEntity(x, y, z);
        if (te != null && te instanceof IPantable) {
            if (!world.isRemote) {
                int colour = ((IPantable) te).getColour(0);
                PaintType paintType = ((IPantable) te).getPaintType(0);
                setToolColour(stack, colour);
                setToolPaintType(stack, paintType);
            }
        }
        return true;
    }
    return false;
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) Block(net.minecraft.block.Block) IPantable(riskyken.armourersWorkshop.api.common.painting.IPantable) PaintType(riskyken.armourersWorkshop.common.painting.PaintType)

Example 23 with PaintType

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

the class ItemDyeBottle method addInformation.

@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean p_77624_4_) {
    super.addInformation(stack, player, list, p_77624_4_);
    if (getToolHasColour(stack)) {
        Color c = new Color(getToolColour(stack));
        PaintType paintType = getToolPaintType(stack);
        String hex = String.format("#%02x%02x%02x", c.getRed(), c.getGreen(), c.getBlue());
        String colourText = TranslateUtils.translate("item.armourersworkshop:rollover.colour", c.getRGB());
        String hexText = TranslateUtils.translate("item.armourersworkshop:rollover.hex", hex);
        String paintText = TranslateUtils.translate("item.armourersworkshop:rollover.paintType", paintType.getLocalizedName());
        list.add(colourText);
        list.add(hexText);
        list.add(paintText);
    } else {
        String emptyText = TranslateUtils.translate("item.armourersworkshop:rollover.empty");
        list.add(emptyText);
    }
}
Also used : Color(java.awt.Color) PaintType(riskyken.armourersWorkshop.common.painting.PaintType)

Example 24 with PaintType

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

the class GuiColourMixer method updatePaintTypeDropDown.

private void updatePaintTypeDropDown() {
    int paintCount = 0;
    paintTypeDropDown.clearList();
    for (int i = 0; i < PaintType.values().length; i++) {
        PaintType paintType = PaintType.values()[i];
        if (i < 12) {
            paintTypeDropDown.addListItem(paintType.getLocalizedName());
            if (paintType == tileEntityColourMixer.getPaintType(0)) {
                paintTypeDropDown.setListSelectedIndex(paintCount);
            }
            paintCount++;
        }
    }
}
Also used : PaintType(riskyken.armourersWorkshop.common.painting.PaintType)

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