I’m trying to think of a way to give players 5 random items out of all the items in the game. I thought about using predicates for randomization but then I thought of maybe doing something with loot tables. Like maybe I could have them spawn on a chest with 5 random items? The issue is I’m not sure if that’s possible and if so how to go about it.
#How to give players random items
1 messages · Page 1 of 1 (latest)
A loot table is the way to go, yes
You can insert them in a chest or just give them with the /loot command
Do you know how I could make said loot table?
Would I need to am manually add every item?
?
You would have to add every possible item ofc
Ok. That’s what I was expecting I was just hoping there would be an option for all
Oh you mean that all items are possible to get?
you can use a tag in the loot table
Like that
{
"type": "minecraft:empty",
"pools": [
{
"rolls": 0,
"entries": [
{
"type": "minecraft:tag",
"name": "taglib:all",
"expand": false,
"functions": []
}
],
"functions": []
}
]
}
that would be the easiest way to add all items to the loot table
And use this really cool data pack by the guy typing
^^
This one is up to date with 1.21.8
Where's it from?
Don't open it in discord though, it nearly crahsed it for me
I just made it
I copied the ite registry file from misodes mcmeta repo and then I converted it to a minecraft tag with 3 easy regex replace
although 2 would be enough
in that order
# Minecraft Datapack folder structure
# Last updated: Jul 1, 2024
.
├── pack.mcmeta
├── pack.png
└── data
└── <namespace>
├── advancement
├── enchantment
├── enchantment_provider
├── function
├── item_modifier
├── loot_table
├── predicate
├── recipe
├── structure
├── chat_type
├── damage_type
├── trim_material
├── trim_pattern
├── jukebox_song
├── painting_variant
├── wolf_variant
├── tags
| ├── banner_pattern
│ ├── block
│ ├── cat_variant
│ ├── damage_type
│ ├── entity_type
│ ├── fluid
│ ├── function
│ ├── game_event
│ ├── instrument
│ ├── item
│ ├── painting_variant
│ ├── point_of_interest_type
│ └── worldgen
├── dimension
├── dimension_type
└── worldgen
├── biome
├── configured_carver
├── configured_feature
├── density_function
├── noise
├── noise_settings
├── placed_feature
├── processor_list
├── structure
├── structure_set
├── template_pool
├── world_preset
└── flat_level_generator_preset
what if i want it to be 5 random items from the pool and not all
You can simply give it a 100% chance and 5 rolls.
If you want to ensure unique items you need a different approach.
Thanks! One more thing, can I make the quantity of each item also random? Say 1-8 or so