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);
}
}
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;
}
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);
}
}
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++;
}
}
}
Aggregations