Search in sources :

Example 16 with PaintType

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

the class ItemPaintRoller method addInformation.

@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean p_77624_4_) {
    super.addInformation(stack, player, list, p_77624_4_);
    Color c = new Color(getToolColour(stack));
    PaintType paintType = getToolPaintType(stack);
    int radius = (Integer) ToolOptions.RADIUS.readFromNBT(stack.getTagCompound());
    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());
    String radiusText = TranslateUtils.translate("item.armourersworkshop:rollover.radius", radius * 2 - 1, radius * 2 - 1, 1);
    list.add(colourText);
    list.add(hexText);
    list.add(paintText);
    list.add(radiusText);
    list.add(TranslateUtils.translate("item.armourersworkshop:rollover.openSettings"));
}
Also used : Color(java.awt.Color) PaintType(riskyken.armourersWorkshop.common.painting.PaintType)

Example 17 with PaintType

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

the class MessageClientToolPaintBlock method onMessage.

@SuppressWarnings("deprecation")
@Override
public IMessage onMessage(MessageClientToolPaintBlock message, MessageContext ctx) {
    EntityPlayerMP player = ctx.getServerHandler().playerEntity;
    if (player != null && player.getEntityWorld() != null) {
        World world = player.getEntityWorld();
        Block block = world.getBlock(message.x, message.y, message.z);
        if (block instanceof IPantableBlock) {
            UndoManager.begin(player);
            IPantableBlock paintable = (IPantableBlock) block;
            int oldColour = paintable.getColour(world, message.x, message.y, message.z, message.side);
            PaintType oldPaintType = paintable.getPaintType(world, message.x, message.y, message.z, message.side);
            UndoManager.blockPainted(player, world, message.x, message.y, message.z, oldColour, (byte) oldPaintType.getKey(), message.side);
            paintable.setColour(world, message.x, message.y, message.z, message.rgbt, message.side);
            paintable.setPaintType(world, message.x, message.y, message.z, PaintType.getPaintTypeFormSKey(message.rgbt[3]), message.side);
            UndoManager.end(player);
        }
    }
    return null;
}
Also used : Block(net.minecraft.block.Block) IPantableBlock(riskyken.armourersWorkshop.api.common.painting.IPantableBlock) EntityPlayerMP(net.minecraft.entity.player.EntityPlayerMP) PaintType(riskyken.armourersWorkshop.common.painting.PaintType) World(net.minecraft.world.World) IPantableBlock(riskyken.armourersWorkshop.api.common.painting.IPantableBlock)

Example 18 with PaintType

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

the class ItemPaintbrush method usedOnBlockSide.

@SuppressWarnings("deprecation")
@Override
public void usedOnBlockSide(ItemStack stack, EntityPlayer player, World world, BlockLocation bl, Block block, int side) {
    int colour = getToolColour(stack);
    PaintType paintType = getToolPaintType(stack);
    IPantableBlock worldColourable = (IPantableBlock) block;
    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();
    UndoManager.blockPainted(player, world, bl.x, bl.y, bl.z, oldColour, oldPaintType, side);
    ((IPantableBlock) block).setColour(world, bl.x, bl.y, bl.z, colour, side);
    ((IPantableBlock) block).setPaintType(world, bl.x, bl.y, bl.z, paintType, side);
}
Also used : PaintType(riskyken.armourersWorkshop.common.painting.PaintType) IPantableBlock(riskyken.armourersWorkshop.api.common.painting.IPantableBlock)

Example 19 with PaintType

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

the class ItemPaintbrush 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;
    }
    if (block instanceof IPantableBlock) {
        int newColour = getToolColour(stack);
        if (!world.isRemote) {
            UndoManager.begin(player);
            if ((Boolean) ToolOptions.FULL_BLOCK_MODE.readFromNBT(stack.getTagCompound())) {
                for (int i = 0; i < 6; i++) {
                    usedOnBlockSide(stack, player, world, new BlockLocation(x, y, z), block, i);
                }
            } else {
                usedOnBlockSide(stack, player, world, new BlockLocation(x, y, z), block, side);
            }
            UndoManager.end(player);
            if ((Boolean) ToolOptions.FULL_BLOCK_MODE.readFromNBT(stack.getTagCompound())) {
                world.playSoundEffect(x + 0.5D, y + 0.5D, z + 0.5D, LibSounds.PAINT, 1.0F, world.rand.nextFloat() * 0.1F + 0.9F);
            } else {
                world.playSoundEffect(x + 0.5D, y + 0.5D, z + 0.5D, LibSounds.PAINT, 1.0F, world.rand.nextFloat() * 0.1F + 1.5F);
            }
        } else {
            spawnPaintParticles(world, x, y, z, side, newColour);
        }
        return true;
    }
    if (block == ModBlocks.armourerBrain & player.isSneaking()) {
        if (!world.isRemote) {
            TileEntity te = world.getTileEntity(x, y, z);
            if (te != null && te instanceof TileEntityArmourer) {
                ((TileEntityArmourer) te).toolUsedOnArmourer(this, world, stack, player);
            }
        }
        ModLogger.log("armourer");
        return true;
    }
    if (block == ModBlocks.mannequin) {
        if (!world.isRemote) {
            TileEntity te = ((BlockMannequin) block).getMannequinTileEntity(world, x, y, z);
            if (te != null && te instanceof TileEntityMannequin) {
                int newColour = getToolColour(stack);
                if (player.isSneaking()) {
                    ((TileEntityMannequin) te).setHairColour(newColour);
                } else {
                    ((TileEntityMannequin) te).setSkinColour(newColour);
                }
            }
        }
        return true;
    }
    return false;
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) BlockMannequin(riskyken.armourersWorkshop.common.blocks.BlockMannequin) TileEntityArmourer(riskyken.armourersWorkshop.common.tileentities.TileEntityArmourer) Block(net.minecraft.block.Block) IPantableBlock(riskyken.armourersWorkshop.api.common.painting.IPantableBlock) IPantable(riskyken.armourersWorkshop.api.common.painting.IPantable) PaintType(riskyken.armourersWorkshop.common.painting.PaintType) BlockLocation(riskyken.armourersWorkshop.common.blocks.BlockLocation) TileEntityMannequin(riskyken.armourersWorkshop.common.tileentities.TileEntityMannequin) IPantableBlock(riskyken.armourersWorkshop.api.common.painting.IPantableBlock)

Example 20 with PaintType

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

the class ItemPaintbrush method addInformation.

@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean p_77624_4_) {
    super.addInformation(stack, player, list, p_77624_4_);
    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);
    list.add(TranslateUtils.translate("item.armourersworkshop:rollover.openSettings"));
}
Also used : Color(java.awt.Color) 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