use of riskyken.armourersWorkshop.common.painting.PaintType in project Armourers-Workshop by RiskyKen.
the class ItemBurnTool method usedOnBlockSide.
@SuppressWarnings("deprecation")
@Override
public void usedOnBlockSide(ItemStack stack, EntityPlayer player, World world, BlockLocation bl, Block block, int side) {
int intensity = (Integer) ToolOptions.INTENSITY.readFromNBT(stack.getTagCompound());
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.makeColourDarker(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.makeColourDarker(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);
}
}
use of riskyken.armourersWorkshop.common.painting.PaintType in project Armourers-Workshop by RiskyKen.
the class ItemDodgeTool method usedOnBlockSide.
@SuppressWarnings("deprecation")
@Override
public void usedOnBlockSide(ItemStack stack, EntityPlayer player, World world, BlockLocation bl, Block block, int side) {
int intensity = (Integer) ToolOptions.INTENSITY.readFromNBT(stack.getTagCompound());
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.makeColourBighter(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.makeColourBighter(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);
}
}
use of riskyken.armourersWorkshop.common.painting.PaintType in project Armourers-Workshop by RiskyKen.
the class ItemHueTool 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"));
}
use of riskyken.armourersWorkshop.common.painting.PaintType in project Armourers-Workshop by RiskyKen.
the class ItemHueTool method usedOnBlockSide.
@SuppressWarnings("deprecation")
@Override
public void usedOnBlockSide(ItemStack stack, EntityPlayer player, World world, BlockLocation bl, Block block, int side) {
boolean changeHue = (boolean) ToolOptions.CHANGE_HUE.readFromNBTBool(stack.stackTagCompound);
boolean changeSaturation = (boolean) ToolOptions.CHANGE_SATURATION.readFromNBTBool(stack.stackTagCompound);
boolean changeBrightness = (boolean) ToolOptions.CHANGE_BRIGHTNESS.readFromNBTBool(stack.stackTagCompound);
boolean changePaintType = (boolean) ToolOptions.CHANGE_PAINT_TYPE.readFromNBTBool(stack.stackTagCompound);
Color toolColour = new Color(getToolColour(stack));
PaintType paintType = getToolPaintType(stack);
float[] toolhsb;
toolhsb = Color.RGBtoHSB(toolColour.getRed(), toolColour.getGreen(), toolColour.getBlue(), null);
IPantableBlock worldColourable = (IPantableBlock) block;
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();
float[] blockhsb;
Color blockColour = new Color(oldColour);
blockhsb = Color.RGBtoHSB(blockColour.getRed(), blockColour.getGreen(), blockColour.getBlue(), null);
float[] recolour = new float[] { blockhsb[0], blockhsb[1], blockhsb[2] };
if (changeHue) {
recolour[0] = toolhsb[0];
}
if (changeSaturation) {
recolour[1] = toolhsb[1];
}
if (changeBrightness) {
recolour[2] = toolhsb[2];
}
int newColour = Color.HSBtoRGB(recolour[0], recolour[1], recolour[2]);
Color c = new Color(newColour);
byte[] rgbt = new byte[4];
rgbt[0] = (byte) c.getRed();
rgbt[1] = (byte) c.getGreen();
rgbt[2] = (byte) c.getBlue();
rgbt[3] = oldPaintType;
if (changePaintType) {
rgbt[3] = (byte) paintType.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();
float[] blockhsb;
Color blockColour = new Color(oldColour);
blockhsb = Color.RGBtoHSB(blockColour.getRed(), blockColour.getGreen(), blockColour.getBlue(), null);
float[] recolour = new float[] { blockhsb[0], blockhsb[1], blockhsb[2] };
if (changeHue) {
recolour[0] = toolhsb[0];
}
if (changeSaturation) {
recolour[1] = toolhsb[1];
}
if (changeBrightness) {
recolour[2] = toolhsb[2];
}
int newColour = Color.HSBtoRGB(recolour[0], recolour[1], recolour[2]);
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);
if (changePaintType) {
((IPantableBlock) block).setPaintType(world, bl.x, bl.y, bl.z, paintType, side);
}
}
}
use of riskyken.armourersWorkshop.common.painting.PaintType in project Armourers-Workshop by RiskyKen.
the class ItemPaintRoller 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) {
if (!world.isRemote) {
UndoManager.begin(player);
}
paintArea(world, block, player, stack, x, y, z, side);
if (!world.isRemote) {
world.playSoundEffect(x + 0.5D, y + 0.5D, z + 0.5D, LibSounds.PAINT, 1.0F, world.rand.nextFloat() * 0.1F + 0.9F);
UndoManager.end(player);
}
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);
}
}
return true;
}
return false;
}
Aggregations