-
Notifications
You must be signed in to change notification settings - Fork 1
Loot Crates ‐ 1.20.1
DaFuqs edited this page Jul 17, 2024
·
1 revision
All Loot Crates, be it chests, barrels or Shulker Crates share the same NBT tags.
These are set directly on the block. When using these Tags on a Loot Crate Item those have to be set under the tag "BlockEntityTag" to have an effect (analog to vanilla items). For examples see below
Tag | NBT Type | Effect |
---|---|---|
LootTable |
loot table | The loot table identifier to be used to fill the crate when it's interacted with |
LootTableSeed |
long | Seed for generating the loot table. 0 or omitted uses a random seed. Setting a seed means that the generated loot will always be the same |
TrackedPerPlayer |
boolean; default: false | If true all logic - besides the inventory - is ran on a per player basis |
LockMode |
string, see below; default: none
|
Controls if the Crate should be locked and if it should relock when there is new loot for the player |
Trapped |
boolean; default: false
|
When true, the Crate will output a Redstone signal when opened, similar to a Trapped Chest |
ReplenishMode |
string, see below; default: never
|
Controls when and how often the Crate should generate new loot |
ReplenishTimeTicks |
long; default: -1
|
Auxiliary data for ReplenishMode to specify the interval between new loot generation |
InventoryDeletionMode |
string, see below; default: never
|
Controls when the Crate should delete its inventory (to counter people cluttering the inventory with loot they do not want to take with them - preventing new loot to be generated for new players) |
Items |
it's complicated | Analog vanilla shulker chests. Defines the items stored in the crate. Can be used to define items that are always present in a crate at first opening. |
Handle some combinations with care. Or do you really want players to have portable containers that generate new loot every minute?
-
"never"
(default): The Crate will never generate new loot after the first time -
"game_time"
: Ingame-Ticks that have to have passed, as specified byReplenishTimeTicks
-
"real_time"
: Real-Life Milliseconds that have to have passed, as specified byReplenishTimeTicks
, measured by the computer clock -
"hourly"
: New loot each full new hour -
"daily"
: New loot each new day (0:00) -
"weekly"
: New loot each new week (Mondays) -
"monthly"
: New loot the first day of the month
-
"none"
(default): Crate is not locked -
"require_key"
: Unlocking the Crate requires a matching Key. The key will not be consumed -
"require_key_relock"
: Unlocking the Crate requires a matching Key. The key will not be consumed. Every time the Crate generates new loot it will require a key again -
"consume_key"
: Unlocking the Crate requires a matching Key. The key will be consumed -
"consume_key_relock"
: Unlocking the Crate requires a matching Key. The key will be consumed. Every time the Crate generates new loot it will require a key again
-
"never"
(default): The inventory will never be deleted automatically -
"on_open"
: The inventory will always be cleared when the inventory is opened -
"when_replenished"
: The inventory will always be cleared when new loot is able to be generated
Following examples use a Rare Chest Loot Crate named "Bastion Treasure Crate" containing the vanilla bastion_treasure loot table, that is locked and will be restocked every 60 ticks (3 seconds).
You can find more examples, like a documented worldgen replacement config file and demo datapack under ./example_datapacks/
/give @p lootcrates:rare_chest_loot_crate{BlockEntityTag:{TrackedPerPlayer:1,LockMode:"NONE",ReplenishMode:"DAILY",InventoryDeletionMode:"WHEN_REPLENISHED",LootTable:"minecraft:chests/village/village_weaponsmith"}, display: {Name: '{"text":"My Crate"}'}}
/give @p lootcrates:blaze_chest_loot_crate{BlockEntityTag: {Items: [{Slot: 4b, id: "minecraft:iron_leggings", Count: 1b, tag: {Damage: 0}}]}}
/setblock ~ ~ ~ lootcrates:rare_chest_loot_crate{TrackedPerPlayer:1,LockMode:"NONE",ReplenishMode:"DAILY",InventoryDeletionMode:"WHEN_REPLENISHED",LootTable:"minecraft:chests/village/village_weaponsmith"}
{
"type": "minecraft:entity",
"pools": [{
"rolls": 1,
"entries": [{
"type": "item",
"name": "lootcrates:rare_chest_loot_crate",
"functions": [{
"function": "set_nbt",
"tag": "{BlockEntityTag:{TrackedPerPlayer:1,LockMode:\"NONE\",ReplenishMode:\"DAILY\",InventoryDeletionMode:\"WHEN_REPLENISHED\",LootTable:\"minecraft:chests/village/village_weaponsmith\"}, display: {Name: '{\"text\":\"My Crate\"}'}}"
}]
}]
}]
}