if (mop == null)
return itemstack;
Block block = world.getBlock(mop.blockX, mop.blockY, mop.blockZ);
int meta = world.getBlockMetadata(mop.blockX, mop.blockY, mop.blockZ);
TileEntity tile = world.getTileEntity(mop.blockX, mop.blockY, mop.blockZ);
ItemWandCasting wand = (ItemWandCasting) itemstack.getItem();
if (player.canPlayerEdit(mop.blockX, mop.blockY, mop.blockZ, mop.sideHit, itemstack)) {
ItemStack stack = getPickedBlock(itemstack);
if (stack != null) {
if (mop.sideHit == 0)
--mop.blockY;
if (mop.sideHit == 1)
++mop.blockY;
if (mop.sideHit == 2)
--mop.blockZ;
if (mop.sideHit == 3)
++mop.blockZ;
if (mop.sideHit == 4)
--mop.blockX;
if (mop.sideHit == 5)
++mop.blockX;
if (block.canPlaceBlockOnSide(world, mop.blockX, mop.blockY, mop.blockZ, mop.sideHit)) {
if (!world.isRemote) {
world.setBlock(mop.blockX, mop.blockY, mop.blockZ, ((ItemBlock) stack.getItem()).field_150939_a, stack.getItemDamage(), 1 | 2);
block.onBlockPlacedBy(world, mop.blockX, mop.blockY, mop.blockZ, player, itemstack);
NBTTagCompound tileCmp = getStackTileEntity(itemstack);
if (tileCmp != null && !tileCmp.hasNoTags()) {
TileEntity tile1 = TileEntity.createAndLoadEntity(tileCmp);
tile1.xCoord = mop.blockX;
tile1.yCoord = mop.blockY;
tile1.zCoord = mop.blockZ;
world.setTileEntity(mop.blockX, mop.blockY, mop.blockZ, tile1);
}