#How to give players random items

1 messages · Page 1 of 1 (latest)

finite jungle
#

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.

errant depot
#

A loot table is the way to go, yes

#

You can insert them in a chest or just give them with the /loot command

finite jungle
#

Do you know how I could make said loot table?

finite jungle
blissful hound
#

You would have to add every possible item ofc

finite jungle
#

Ok. That’s what I was expecting I was just hoping there would be an option for all

blissful hound
#

Oh you mean that all items are possible to get?

next oracle
#

you can use a tag in the loot table

blissful hound
#

Like that

{
  "type": "minecraft:empty",
  "pools": [
    {
      "rolls": 0,
      "entries": [
        {
          "type": "minecraft:tag",
          "name": "taglib:all",
          "expand": false,
          "functions": []
        }
      ],
      "functions": []
    }
  ]
}
next oracle
#

that would be the easiest way to add all items to the loot table

blissful hound
#

And use this really cool data pack by the guy typing

#

^^

next oracle
blissful hound
#

Where's it from?

next oracle
#

Don't open it in discord though, it nearly crahsed it for me

next oracle
blissful hound
#

?

#

How?

next oracle
#

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

blissful hound
#

huh

#

cool

next oracle
zealous sentinelBOT
#
# 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
ebon thistleBOT
finite jungle
ivory crescent
finite jungle
ivory crescent
#

You can do so using the function of the entry object

#

Just check misode for the exact options and JSON to do so.