Lootboxes
Placeable lootbox items that play an in-world show and hand out several rewards plus a jackpot.
A lootbox is a separate kind of crate. There are no keys, no menu and no crate block: a lootbox is an
item. The player places it on the ground, an in-world show plays above it, and they get
Rewards-Amount different rewards from the normal pool plus one jackpot from the jackpot pool.
Lootboxes live in their own folders:
lootboxes/- one file per lootbox (its item, reward pools and how many rewards it gives). See lootboxes.lootbox-animations/- one file per show (orbit,helix,wheel,burst). See lootbox animations.
Four example lootboxes ship, one per animation: example (orbit), example-helix,
example-wheel and example-burst.
Giving lootboxes
Section titled “Giving lootboxes”/cratesadmin lootbox <player> <lootbox> [amount] [-s]<lootbox>is the file name without.yml, for exampleexample-wheel.[amount]defaults to1. Amounts accept suffixes like/cratesadmin give(10,1k).- The player must be online. The items go into their inventory, and whatever does not fit is dropped at their feet.
- One command gives at most a full inventory (36 stacks). A larger amount answers
AMOUNT-TOO-LARGE. -sskips theLOOTBOX-RECEIVEDmessage.
Lootbox items are tagged, so they can be traded, stored in chests or sold in a shop like any other item. Whoever places one opens it.
Opening
Section titled “Opening”- The player places the lootbox like a block. No block is ever placed: the placement is cancelled and one item is taken from the stack.
- The box rises out of the ground, grows and starts spinning.
- The reward icons deploy around it and shuffle through the pool, then lock onto the rolled rewards one by one, each with its name above it.
- The jackpot rises out of the box (or falls from the sky, for
burst), cycles through the jackpot pool and lands on the rolled jackpot. - After a short hold, every icon flies back into the box, the rewards are handed out and
LOOTBOX-OPENEDlists them in chat.
The show is sent as packets, so nothing is left behind in the world and nothing can be broken or
picked up. Everyone within the animation’s View-Distance sees it.
- The player needs
optimalcrates.use. - A player can run one lootbox at a time (
LOOTBOX-BUSY). - A lootbox cannot be opened within 4 blocks of another one that is still running
(
LOOTBOX-TOO-CLOSE). - Protection plugins are respected. If a region plugin would block the placement, nothing happens and the item is kept.
- A lootbox item whose file was deleted answers
LOOTBOX-UNAVAILABLEand is kept.
Rewards and the jackpot
Section titled “Rewards and the jackpot”Rewardsis the normal pool.Rewards-Amountrewards are drawn from it without repeats, so a lootbox withRewards-Amount: 4always gives four different rewards.Jackpot-Rewardsis the jackpot pool. Exactly one jackpot is drawn every time.- Both pools use the crate reward format:
Display-Item,Items,ActionsandChance. Chances are weights, just like in crates.
The item lore can list both pools automatically with {exclusive-items} and {jackpot-items},
one line per reward. See lootboxes.
Creating a lootbox
Section titled “Creating a lootbox”- Copy one of the shipped files in
lootboxes/, for exampleexample.ymltolegendary.yml. - Change
Settings.Display-Name, theItemand both reward pools. - Pick a show with
Settings.Animation(orbit,helix,wheel,burstor one of your own files inlootbox-animations/). - Run
/cratesadmin reloadand/cratesadmin lootbox <you> legendary.
A lootbox whose file is broken, or whose Animation names a show that did not load, fails to load
with its file name and the reason in the console. Every other lootbox keeps working.
