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