============================================
 DATAPACK: RANDOM BLOCK DROPS
 (Minecraft 1.16.x, 1.17.x, 1.18.x, 1.19.x)
 Version 3.1 - unified build
============================================

WHAT IT DOES
------------
Every block you mine can drop almost anything in the game - completely
unrelated to the block you broke. The ODDS depend on
*which* block you break: dirt overwhelmingly gives junk, diamond ore
overwhelmingly gives good stuff. It's still technically possible to
mine dirt and get an elytra - it's just astronomically unlikely.
Mine diamond ore and decent loot is closer to a coin flip.

Mobs are untouched: they still give their normal vanilla drops, nothing
extra.

On world join or /reload you'll see:
  [Random Block Drops] Datapack loaded (v3.1).

This is ONE file for Minecraft 1.16 through 1.19.4. It replaces the two
separate v2.2 ports (1.16.x, and 1.17.x-1.18.x), and as of 3.0 it also
carries the 1.19.x support that used to live in the main pack. For
1.20 and newer use the main Random Block Drops 3.0 datapack instead -
this build is not meant for those versions (see VERSION COMPATIBILITY).

LOOT POOL (353 items, 5 item-rarity classes)
-------------------------------------------
  COMMON (124 items): basic materials, cooked food, seeds, flowers,
    wool/dye/carpet in all 16 colors, planks and saplings for the 8
    wood types that exist on 1.16.x, wood/stone tools.
  UNCOMMON (151 items): nuggets, redstone components, furniture,
    concrete/terracotta/stained glass in all 16 colors, iron/gold
    tools, iron/chainmail armor.
  RARE (57 items): ingots, diamond, bow, crossbow, shield, beacon,
    ender chest, shulker box, mob heads, music discs, diamond tools,
    gold/diamond armor.
  EPIC (16 items): netherite gear, totem of undying, trident,
    shulker/nautilus shells, heart of the sea.
  LEGENDARY (5 items): netherite ingot, elytra, dragon egg, nether
    star, enchanted golden apple.

The pool is the same on every supported version. It only contains items
that exist on ALL of 1.16 - 1.19, because an unknown item ID in a loot
table is a hard error (that block's table fails to load and the block
falls back to vanilla drops). That means everything added after 1.16 is
left out: copper ingot, glow berries and spyglass (1.17), or mangrove
planks, goat horn, recovery compass and echo shard (1.19), for example.
Nothing in the pool was removed or renamed between 1.16 and 1.19.4. See
MERGE NOTES below.

BLOCK RARITY TIERS (93 blocks; 71 exist on 1.16.x, 90 on 1.17.x-1.18.x,
all 93 on 1.19.x)
-------------------------------------------
Every one of the minable blocks belongs to one of 5 tiers based on
how hard it normally is to obtain in vanilla survival. Each tier uses
a different weight for the same 5 item classes above, so the pool of
possible drops never changes, only the odds of landing on each class.
The odds below were computed directly from the loot table files in
this build.

  Tier 1 - Dirt & Foliage (24 blocks): dirt, sand, red sand, gravel, mud,
    clay, grass block, snow, ice, cactus, bamboo, podzol, mycelium,
    coarse dirt, rooted dirt, and the leaf types (oak, spruce, birch,
    jungle, acacia, dark oak, azalea, flowering azalea, mangrove).
    -> ~58% common, ~40% uncommon, ~1.7% rare, ~0.05% epic and
       ~0.015% legendary. Epic and legendary items share the game's
       minimum integer drop weight (1) at this tier, so any single
       epic or legendary item is equally likely (roughly 1 in 1,620
       for the epic-or-legendary group as a whole).

  Tier 2 - Stone & Wood (36 blocks): stone, cobblestone, deepslate,
    cobbled deepslate, andesite, diorite, granite, tuff, calcite,
    sandstone, red sandstone, terracotta, netherrack, glowstone, magma
    block, melon, pumpkin, snow block, packed/blue ice, sponge, bone
    block, end stone, soul sand, soul soil, crimson/warped nylium, and
    the log types (oak, spruce, birch, jungle, acacia, dark oak,
    mangrove, crimson stem, warped stem).
    -> ~46% common, ~50% uncommon, ~4.2% rare, ~0.18% epic,
       ~0.02% legendary (roughly 1 in 5,440)

  Tier 3 - Early Ores & Specials (25 blocks): coal, copper, iron,
    redstone and lapis ore (+ deepslate variants), nether gold ore,
    nether quartz ore, blackstone, basalt, obsidian, dripstone block,
    amethyst block, moss block, prismarine, prismarine bricks, dark
    prismarine, sea lantern, shroomlight, nether/warped wart block.
    -> ~28% common, ~60% uncommon, ~11% rare, ~0.91% epic,
       ~0.09% legendary (roughly 1 in 1,170)

  Tier 4 - Gold Tier (3 blocks): gold ore, deepslate gold ore,
    crying obsidian.
    -> ~17% common, ~49% uncommon, ~29% rare, ~3.7% epic,
       ~0.47% legendary (roughly 1 in 215)

  Tier 5 - Diamond Tier (5 blocks): diamond ore, emerald ore,
    ancient debris (+ deepslate diamond/emerald variants).
    -> ~9.0% common, ~33% uncommon, ~46% rare, ~10% epic,
       ~2.2% legendary (roughly 1 in 46)

On older versions the blocks that don't exist yet simply never get
mined, so their loot tables are never used. They are harmless. That is
the 19 blocks added in 1.17 (deepslate and all its ore variants,
cobbled deepslate, copper ore, tuff, calcite, amethyst block, dripstone
block, moss block, rooted dirt, azalea leaves and flowering azalea
leaves) on 1.16.x, and the 3 blocks added in 1.19 (mud, mangrove
leaves, mangrove log) on 1.16.x - 1.18.x.

FORTUNE (new in 3.0)
--------------------
The Fortune enchantment on the tool you mine with shifts the odds of
every block towards the better item classes. The pool of items never
changes, only the weight of each class:

  Per Fortune level, every class weight is multiplied by:
    common x0.92 | uncommon x1.00 | rare x1.30 | epic x1.50 |
    legendary x1.70
  The factors compound, so Fortune III is those numbers cubed.
  Fortune IV and above (commands, other datapacks) count as Fortune III.

Mining with the bare hand or any tool without Fortune is exactly the
same as in 2.3 - the Fortune 0 odds are the ones listed in BLOCK RARITY
TIERS above (checked: identical, block by block). Silk Touch is not
involved. Still exactly 1 item per block broken.

Why it reads the tool directly: in vanilla, the Luck attribute and the
Luck potion are not passed to block loot tables, so loot-table "luck"
can't be used for blocks. The tables check the Fortune level of the
tool instead (table_bonus condition).

Odds per tier and Fortune level (this build's 353-item pool):

  Tier 1 - Dirt & Foliage      common  uncommon  rare    epic+legendary
    Fortune 0                   58.3%   39.9%    1.68%   1 in 1,620
    Fortune I                   56.0%   41.7%    2.27%   1 in 988
    Fortune II                  53.5%   43.3%    3.07%   1 in 628
    Fortune III                 50.9%   44.7%    4.12%   1 in 384
  Tier 2 - Stone & Wood
    Fortune 0                   45.6%   50.0%    4.19%   1 in 513
    Fortune I                   43.0%   51.2%    5.58%   1 in 328
    Fortune II                  40.2%   52.0%    7.37%   1 in 214
    Fortune III                 37.2%   52.4%    9.66%   1 in 139
  Tier 3 - Early Ores & Specials
    Fortune 0                   28.2%   60.1%   10.70%   1 in 100
    Fortune I                   25.6%   59.2%   13.70%   1 in 67
    Fortune II                  22.9%   57.6%   17.32%   1 in 46
    Fortune III                 20.1%   55.1%   21.55%   1 in 31
  Tier 4 - Gold Tier
    Fortune 0                   17.3%   49.3%   29.22%   1 in 24
    Fortune I                   14.6%   45.0%   34.67%   1 in 17
    Fortune II                  11.9%   40.0%   40.13%   1 in 13
    Fortune III                  9.5%   34.7%   45.27%   1 in 10
  Tier 5 - Diamond Tier
    Fortune 0                    9.0%   32.9%   45.50%   1 in 8
    Fortune I                    6.9%   27.5%   49.43%   1 in 6
    Fortune II                   5.2%   22.3%   52.24%   1 in 5
    Fortune III                  3.8%   17.7%   53.80%   1 in 4

  Legendary alone (Jackpot!) at Fortune III: Tier 1 about 1 in 1,215,
  Tier 3 about 1 in 259, Tier 5 about 1 in 17 (at Fortune 0: 1 in 6,804,
  1 in 1,172 and 1 in 46).

How it is built: every block table is a thin wrapper that points at
one of 5 shared tier tables (rbd:tier/t1 ... t5 = Tier 1 ... Tier 5
above). Each tier table has 4 pools (Fortune 0, I, II, III+), exactly
one of which is active for a given tool. Each pool picks one of 5
shared class tables (rbd:class/common ... rbd:class/legendary) by
weight, and the class table picks the item. The item list lives in the
class tables and the odds live in the tier tables, so changing a tier's
odds is one file instead of 24-36 block files. Unzipped, the pack is
about 69% smaller than 3.0 (452 KB down to 142 KB).

BLOCKS: 1 random item guaranteed per break, from any of the covered
  blocks, weighted by that block's rarity tier above.
MOBS: normal vanilla drops only - no random loot.

TRADE-OFF
------------
Silk Touch does not protect anything - breaking any block, with or
without it, gives random loot.

LEGENDARY FEEDBACK (new in 3.1)
-------------------------------
Picking up a legendary item (netherite ingot, elytra, dragon egg, nether
star, enchanted golden apple) now plays a short celebration for you: a
"LEGENDARY DROP!" title with the item's name underneath, a level-up
sound and a burst of totem particles. Players within 24 blocks also hear
a twinkle.

It happens every time, not just the first one (the Jackpot! achievement
still only fires once).

It reacts to PICKING UP the item from the ground, which is how every
legendary from a mined block reaches you. Crafting a netherite ingot,
taking one out of a chest or moving it between slots does not trigger
it. Dropping a legendary and picking it back up does.

How it works: pickups of the 5 legendary items are counted with
scoreboard stats (objectives rbd_lg_*, created by rbd:load). A hidden
advancement (rbd:legendary_wake) wakes the pack up when a legendary
lands in an inventory; one tick later the counters are checked, the
feedback plays and the counters reset. There is no tick function.

ACHIEVEMENTS (24 total)
---------------
A small "beat the game with this datapack" achievement arc, all
branching off the main "Random Block Drops" advancement:

  - Suited in Diamonds   - get a full diamond armor set
  - Diamond Tool Kit     - get a full diamond tool set (branches off
                            Suited in Diamonds)
  - Netherite Novice     - get a full netherite armor set
  - Netherite Tool Kit   - get a full netherite tool set (branches off
                            Netherite Novice)
  - Full Metal Jacket    - get a full iron armor set
  - Iron Tool Kit        - get a full iron tool set (branches off
                            Full Metal Jacket) [NEW in 2.3]
  - Midas Touch          - get a full golden armor set
  - Golden Tool Kit      - get a full golden tool set (branches off
                            Midas Touch) [NEW in 2.3]
  - Second Chance        - obtain a Totem of Undying
  - Dragon's Hoard       - obtain a Dragon Egg
  - Ancient Knowledge    - obtain an Enchanted Book
  - Davy Jones' Locker   - obtain a Trident, a Nautilus Shell and a
                            Heart of the Sea
  - Skull Collector      - obtain all 6 head/skull items (Creeper,
                            Dragon, Player, Skeleton, Wither Skeleton,
                            Zombie) - the "Piglin" slot of the main
                            pack is a Player Head here, since
                            piglin_head doesn't exist on these versions
  - Greatest Hits        - obtain all 13 music discs available on
                            1.16.x - 1.17.x, including Pigstep. Otherside
                            (added in 1.18) is left out so the
                            achievement is the same on every version
  - Jackpot!              - get any legendary item from mining
  - Collector of Legends - get all 5 legendary items (branches off Jackpot)
  - The Final Frontier   - enter the End
  - Against All Odds     - defeat the Ender Dragon (branches off The
                            Final Frontier)
  - Wither Away          - defeat the Wither
  - Shell Shocked         - obtain a Shulker Shell
  - Chain Reaction        - obtain a full chainmail armor set
  - Vault Keeper          - obtain a Beacon, a Conduit, an Ender Chest
                            and a Shulker Box
  - Fortune Hunter        - obtain Coal, Redstone, Lapis Lazuli, Nether
                            Quartz, a Diamond and an Emerald - the six
                            drops Fortune is made for [NEW in 3.0]

Iron Tool Kit and Golden Tool Kit complete the pattern that already
existed for diamond and netherite: every armor-set achievement now has
a matching tool-set achievement branching off it.

None of the criteria reference version-specific items, so all 24
advancements behave identically on 1.16.x through 1.19.x. Icons use
the legacy "item" key, which is what every version before 1.20.5
expects, so the custom advancement tab displays correctly.

INSTALLATION
------------
1. Delete any previous version of the "random_block_drops" folder/zip
   from .minecraft/saves/<world>/datapacks/
2. Copy this new zip (or the unzipped folder) there.
3. /datapack list
4. If it shows up in green under "enabled", you're done. If it shows
   up under "available" instead (see VERSION COMPATIBILITY below),
   run:
     /datapack enable "file/<name of the zip or folder>"
5. /reload

VERSION COMPATIBILITY
-------------------------
Item IDs (every loot table entry and every achievement criterion),
were checked against the game's own item registries of 1.16, 1.16.1,
1.16.2, 1.16.5, 1.17, 1.17.1, 1.18, 1.18.1, 1.18.2, 1.19, 1.19.1,
1.19.2, 1.19.3 and 1.19.4. Loot table syntax (pool-level conditions,
the table_bonus condition and nested loot_table entries, all used by the
Fortune tables), the kill/dimension achievement triggers and the item
predicate schema were compared against vanilla's own data for 1.16.5,
1.17.1, 1.18.2 and 1.19.4.

Data pack format numbers are different for each of these versions:
  1.16 - 1.16.1 = 5     1.16.2 - 1.16.5 = 6
  1.17.x = 7            1.18 - 1.18.1 = 8       1.18.2 = 9
  1.19 - 1.19.3 = 10    1.19.4 = 12
A pack can only declare one of them before 1.20.2, so pack.mcmeta
declares pack_format 6 (and 5-12 in the newer supported_formats fields,
which these versions ignore). Concretely: 1.16.2 - 1.16.5 see an exact
match; every other version in the range shows the usual "made for a
different version" format warning. That warning is a label, not a
functional gate - the pack works normally. The one practical effect is
that on some versions/worlds the pack can land in "available" instead
of "enabled" and needs the manual /datapack enable from step 4 above.

Pack format 6 (not 5) is on purpose: Minecraft 1.15.x also uses format
5, and this pack is full of Nether Update content that doesn't exist
there. Declaring 6 means a 1.15.x world shows a mismatch warning
instead of a false "perfect match". Do not use this build on 1.15.x.

MERGE NOTES (how this build was made from the two v2.2 ports)
-------------------------
- LOOT TABLES: the block set is the 1.17.x-1.18.x one (90 blocks) and
  the item pool is the 1.16.x one (353 items). The 71 tables of blocks
  that exist on 1.16.x are byte-for-byte identical to the 1.16.x port;
  the 19 tables for 1.17-only blocks are the 1.17.x-1.18.x port's with
  copper ingot, glow berries and spyglass removed. Everything else -
  weights, tiers, set_count ranges - is unchanged, and matches the main
  2.3 pack for every block and item they share.
- ITEM PREDICATES: Minecraft 1.16.x reads a single "item" field inside
  an item predicate; 1.17.x and later read an "items" list. The two
  older ports each used only one of them. In this build every
  predicate in every achievement carries BOTH ("item": X and
  "items": [X]). Each version reads the field it understands and
  ignores the other, so the achievements check for the exact item on
  all three versions.
- JACKPOT!: uses the 1.16.x structure - 5 separate criteria (one per
  legendary item) in a single OR-group, so any one of them completes
  it - because a 1.16.x predicate can only name one item.
- 1.19.x SUPPORT (new in 3.0): the item pool needed no change, since
  every one of the 353 items exists on 1.19 - 1.19.4. The only addition
  is the loot tables of the 3 blocks that 1.19 introduced (mud, mangrove
  leaves, mangrove log), with the same tiers they have in the main pack.
  The kill, dimension and inventory achievements use the same syntax
  vanilla itself uses on 1.19.4.
- ADVANCEMENT TAB BACKGROUND: uses minecraft:textures/block/
  diamond_ore.png, which exists on every version (deepslate diamond ore
  doesn't exist before 1.17).
- The 1.16.x port's one-time achievement reset function
  (rbd:adv_fix / rbd:tick) is NOT included. It existed to clean up
  after an earlier 1.16.x build that had the wrong predicate schema,
  and here it would wipe legitimately earned achievements once on
  1.17.x and 1.18.x worlds.

MOBS - normal drops only, no overrides at all
-------------------------------------------
This pack doesn't ship loot_table files for any mob. With nothing
defined, Minecraft simply falls back to real vanilla loot for every
mob. It also means this pack won't clobber a custom mob loot table from
another datapack running alongside it.

CHANGELOG - 3.1
------------
- NEW: legendary feedback (see LEGENDARY FEEDBACK above). Hidden
  advancement rbd:legendary_wake, functions rbd:legendary/wake, poll
  and found, and 5 scoreboard objectives created in rbd:load. No tick
  function.
- Loot table layout: the 93 block tables are now thin wrappers around
  5 shared tier tables (rbd:tier/t1 ... t5) instead of each carrying
  its own copy of the 4 Fortune pools. The odds are unchanged: every
  block gives exactly the same class distribution as 3.0 at every
  Fortune level (checked block by block). Unzipped size goes from
  452 KB to 142 KB, the zip from 70 KB to 55 KB.
- pack.mcmeta description and the in-game load message bumped to v3.1.

CHANGELOG - 3.0
------------
- FORTUNE now improves block drops: each level shifts the odds towards
  rare, epic and legendary items (see FORTUNE above). Fortune 0 is
  identical to 2.3.
- 1.19.x support (1.19 - 1.19.4) moved here from the main pack. This
  build now covers 1.16.x - 1.19.x, and the main pack starts at 1.20.
  Added loot tables for mud, mangrove leaves and mangrove log.
- Loot table layout: the 353-item list is stored once in 5 class tables
  (rbd:class/*) instead of being repeated in all 93 block tables. Same
  items, same set_count ranges, same item order per class.
- 1 new achievement: Fortune Hunter (Coal, Redstone, Lapis Lazuli,
  Nether Quartz, Diamond and Emerald). 24 achievements total.
- pack.mcmeta: description updated; supported_formats / max_format
  raised from 9 to 12 for 1.19.x. Bumped the load message to v3.0.

CHANGELOG - 2.3 (unified 1.16.x - 1.18.x build)
------------
- One datapack for 1.16.x, 1.17.x and 1.18.x instead of two.
- 2 new achievements: Iron Tool Kit (branches off Full Metal Jacket)
  and Golden Tool Kit (branches off Midas Touch), completing the
  armor-set-to-tool-set pattern that Diamond Tool Kit and Netherite
  Tool Kit already established. 23 achievements total (was 21).
- Bumped the in-game load message to v2.3.
- pack.mcmeta description updated (it no longer implies mobs drop
  random loot - they never have since 2.0).
- 1.17.x and 1.18.x lose 3 items that only exist there (copper ingot,
  glow berries, spyglass) - the price of sharing one loot pool with
  1.16.x.
- 26.x-specific changes in 2.3 (new overlay tiers, Poplar/Wilderness
  Bound items, new syntax) don't apply to these versions.

CHANGELOG - 2.2 (carried over from both ports)
------------
- Tier 3 blocks give common and rare items properly separated drop
  weights (previously a diamond sword was as likely as a stick there).
- Root advancement icon without the redundant "count" field.
- Shell Shocked, Chain Reaction and Vault Keeper achievements.
- Removed the redundant "add": false from every set_count function.
