Crossbow

A crossbow is a ranged weapon that uses arrows or fireworks as ammunition.

Pillagers
Pillagers have a small chance (8.5%) of dropping a loaded or unloaded crossbow when killed; this rate increases by 12% per level of Looting.

Natural generation
Crossbows have a 50% chance to be found in pillager outpost watchtower chest.

Trading
Journeyman-level Fletcher villagers sell an unenchanted crossbow for 3 emeralds.

Master-level Fletcher villagers have a $1/16$ (6.25%) chance of selling an enchanted crossbow for 8 emeralds.

Master-level Fletcher villagers have $2/3$ chance of selling an enchanted crossbow for 7-22 emeralds.

Usage
Despite using iron in its crafting recipe, it cannot be smelted into iron nuggets.

Weapon
Crossbows are similar to bows, but take longer to load and are slightly more powerful, shooting farther due to slightly higher accuracy. They can be drawn back by them, forcing the player to move at a sneaking speed, and unlike bows, the arrow or firework rocket can be fired only after it is fully charged. Once it has reached full charge, the player's speed returns to normal and the crossbow can be placed in another inventory slot or into an item frame without the arrow or firework rocket being unloaded or fired. In order to use the crossbow, at least one arrow or firework rocket must be present in the inventory. The player can choose which type of arrow to fire based on its location in the inventory. Arrows in the off-hand, or the selected hotbar slot if the crossbow is in the off-hand, are prioritized first. If there are no arrows in the off-hand or selected hotbar slot, the arrow closest to slot 0 is selected. Once loaded, a crossbow retains its ammunition even if unselected.

Endermen teleport away from projectile paths, so they cannot be hit with crossbow arrows.

Fireworks
Firework rockets can be fired by loading the crossbow while holding the rockets in the off-hand. They fly at 32 m/s. Firework rockets with higher flight duration have a longer time before they explode and therefore travel farther.

Firework rockets also work with the Multishot enchantment, enabling the player to shoot 3 firework rockets at a time.

A shot firework rocket explodes instantly when it hits a mob or block. If the firework rocket has no explosion effect, it deals no damage. The explosion of a firework rocket deals to  points of damage, with one firework star. Each additional firework star on the rocket deals an additional to  points of damage, for a maximum of  to  with 7 firework stars.

Repair
Crossbows can be repaired in an anvil or grindstone by combining two crossbows. Any loaded ammunition is retained from the crossbow in the first slot, but sacrificed from the crossbow in the second slot.

Enchantments
Crossbows can receive 3 unique enchantments, and have a base enchantability of 1.

Enchantments specific to crossbows include Quick Charge, Multishot, and Piercing. Multishot and Piercing are mutually exclusive, and normal methods of applying enchantments allow only one of them to be applied to a single crossbow. It is possible to use commands to apply both to a single crossbow.
 * Quick Charge (I–III) decreases the reloading time of the crossbow by level * 0.25 seconds. Crossbows with Quick Charge III fire slightly faster than bows. If commands are used to enchant a crossbow with Quick Charge V, the crossbow charges instantaneously. A crossbow enchanted with Quick Charge VI is effectively impossible to charge, which renders it useless. This can be done only in Java Edition.
 * Multishot (I) makes the crossbow fire a spread of 3 projectiles at once instead of a single projectile, which is useful for targeting mobs spread out in a small area. This works for both arrows and firework rockets. Each shot still costs one projectile, and because of that, it is possible to recover only one of three arrows shot from a Multishot crossbow. Multishot crossbows use 3 durability points per shot. A crossbow can have either multishot or piercing, but not both.
 * Piercing (I–IV) makes arrows shot from the crossbow pierce entities they hit and continue their flight, which allows each arrow to hit up to level + 1 entities. This is useful for targeting mobs closely packed together.

If commands are used to enchant a crossbow with Piercing V or a higher level of the enchantment, the enchantment has no effect, and arrows shot from the crossbow do not pass through hit entities.

Crossbows can also be enchanted with Mending and Unbreaking.

Fuel
Crossbows can be used as fuel in furnaces, smelting 1.5 items per crossbow.

Trivia

 * Crossbows enchanted with Quick Charge VI and above get stuck on the first frame on the recharging animation because the resulting charge time is negative, and the game never reaches the time markers that tell it to advance the animation or the reloading procedure itself. It is technically possible to charge such crossbows, but this would require overflowing the value that determines how long the crossbow has been charged. This takes such an amount of time that this is practically impossible: for example, charging a crossbow with Quick Charge VI would take 69.4 years to complete.
 * Due to being able to be put away and still be loaded, a player could have 9 crossbows in their hotbar, allowing for the rapid unloading of arrows. With average damage, this does 90 total damage with normal arrows, which is enough to kill a player in Protection IV diamond armor with resistance II (38.1 damage total, taking armor toughness into account), the highest effect obtainable in a survival game without using a Potion of the Turtle Master.
 * In terms of ammunition, power, and single targets, bows are more effective with the Infinity and Power enchantments, while crossbows are good at crowd-controlling with Multishot/Piercing enchantments.
 * Loading a crossbow with fireworks and then firing it at an enderman or wither with its Wither Armor active can damage it. This is because fireworks deal explosion damage and not projectile damage. This is the only method of damaging an enderman or wither with its Wither Armor at long range.
 * Piercing enchantment can be useful to save arrows because they can still be picked up after they hit a wall.
 * Shooting a charged crossbow will not delay any of your current action like sprinting, swimming, etc.
 * Although Piercing allows arrows to bypass shields, they can't get through the Wither Armor.