Crates System
What this add-on is:
CratesSystem is a Bedrock add-on that lets server/map creators place in‑world “loot crates” with weighted random rewards. Players open them using custom key items, and rewards are drawn from the contents of a linked chest/barrel/shulker box using configurable weights set via item name tags.
Key features:
- In‑game creation UI: Use a creator tool item on a container to define a new crate (name, key item, interaction location, and linked chest location).
- In‑game editing and deletion: Use the same creator tool on an existing crate’s container to edit its settings or delete it.
- Weighted loot: Place items in the linked container and set their weights via name tags (“Display Name|Weight”). The add-on calculates drop chances and shows them in a preview UI.
- Persistence: Crate configs are saved using world dynamic properties so they survive world restarts.
- Cleanup helpers: Prevents players from picking up special tag items used internally during crate animations and cleans them up if a player disconnects.
How to use (in‑game)
Requirements for players
- Hold the creator tool item (default ID: `cs:create`).
- Look at a chest, barrel, or shulker box and use the item (interact).
Creating a crate
- Interact with an empty container while holding the creator tool.
- Fill out the form:
- Crate Name (supports § color formatting).
- Select which key item opens this crate (from the configured list, e.g. `cs:key1`, `cs:key2`, etc.).
- Loot Location: the block coordinates where the loot is optained from for the crate get get its rewards
- Toggle: Delete contents of the chest after creation.
- After creation, open the configured chest/barrel/shulker location and place reward items with name tags formatted as `Display Name:Weight/%` (for example, `Diamond Sword:10`). The weight sets how likely that item is compared to the rest.
Editing or deleting a crate
- Look at the container that was used when the crate was created and use the creator tool.
- A menu shows current details. Choose:
- “Edit Details” to rename, change key, or change interaction/chest locations.
- “Delete Crate” to remove it.
Opening crates (for players)
- Stand at the configured interaction location for a crate.
- Hold the matching key item and interact (the add-on is intended to check the player’s held key and open the linked chest’s loot).
- If configured, the add-on rolls a weighted random reward from the linked container and gives it to the player.
How to add items to the crates
- Get an anvil and place it down
- Rename the item to the Name:%
- The % is the chance of the player getting that item.
Installation (how to install it on a world/server)
- Make sure your world has “Beta APIs” enabled in Experiments.
- Place the add‑on’s BP (behavior pack) and RP (resource pack) into your world’s `behavior_packs` and `resource_packs` folders, or import the .mcaddon file to activate it on the world.
