use of riskyken.armourersWorkshop.api.common.painting.IPantableBlock in project Armourers-Workshop by RiskyKen.
the class ItemSoap method onItemUse.
@Override
public boolean onItemUse(ItemStack itemStack, EntityPlayer entityPlayer, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) {
Block block = world.getBlock(x, y, z);
if (block instanceof IPantableBlock) {
IPantableBlock paintableBlock = (IPantableBlock) block;
// DOTO This may make block sides transparent.
}
if (block == ModBlocks.boundingBox) {
BlockBoundingBox bb = (BlockBoundingBox) block;
if (!world.isRemote) {
bb.setColour(world, x, y, z, 0x00FFFFFF, side);
bb.setPaintType(world, x, y, z, PaintType.NONE, side);
world.playSoundEffect(x + 0.5D, y + 0.5D, z + 0.5D, LibSounds.PAINT, 1.0F, world.rand.nextFloat() * 0.1F + 0.9F);
}
return true;
}
return false;
}
use of riskyken.armourersWorkshop.api.common.painting.IPantableBlock in project Armourers-Workshop by RiskyKen.
the class ItemBlendingTool 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 (block instanceof IPantableBlock) {
if (!world.isRemote) {
UndoManager.begin(player);
usedOnBlockSide(stack, player, world, new BlockLocation(x, y, z), block, side);
UndoManager.end(player);
world.playSoundEffect(x + 0.5D, y + 0.5D, z + 0.5D, LibSounds.BURN, 1.0F, 1.0F);
}
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;
}
use of riskyken.armourersWorkshop.api.common.painting.IPantableBlock in project Armourers-Workshop by RiskyKen.
the class ItemBurnTool 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 (block instanceof IPantableBlock) {
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);
}
if (!world.isRemote) {
UndoManager.end(player);
world.playSoundEffect(x + 0.5D, y + 0.5D, z + 0.5D, LibSounds.BURN, 1.0F, 1.0F);
}
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;
}
use of riskyken.armourersWorkshop.api.common.painting.IPantableBlock 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.api.common.painting.IPantableBlock 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);
}
}
Aggregations