2

So, I could only find explanations on how to copy a player's inventory into a chest, but I'm wondering how I would copy the chest's contents to the player's inventory.

Not necessary to read, just some more explanation on what I'm making: I made scoreboards, different scoreboard ranks means access to different doors, etc... I want to make loadouts, so that people with different scoreboard "ranks" (The ranks correspond to different numbers) can basically get a loadout, while others without the "permission" (Score) can't.

I've tried doing it with plugins, but then I forgot that most plugins don't really allow you to make a command block system that works with it, so that idea failed. I tried a couple of more things, like just dropping it with a dispenser, but then the dispenser would need to be refilled, etc...

So, is there any way I could copy the chest's contents to a player's inventory, so that they get the loadout, while still keeping the original chest's contents

3
  • What was the method for copying inventory to the chest? Perhaps you could just reverse it? Dec 19, 2020 at 20:37
  • Copying from inventory to chest would be the /data modify command, but once I switch the roles, I get a minecraft error. Dec 20, 2020 at 18:19
  • I found a workaround to dynamically copy inventory slots to player inventory. Dec 20, 2020 at 18:27

1 Answer 1

1

I would have put this in a comment, but apparently I need 50 reputation to comment. Instead of using a chest, you could use loot tables. And if you still need to have a chest with the items, you can just load the loot table into a chest. You can generate a loot table here. For example, to load the "End City Treasure" loot table into a chest, you can use /setblock <X> <Y> <Z> minecraft:chest{LootTable:"chests/end_city_treasure"} replace. To load the "End City Treasure" loot table into an inventory, use /loot give @p loot minecraft:chests/end_city_treasure. For more information on loot tables, go here. For more information on the /loot command, go here

1
  • i would wait until you get that 50 rep before you make comment like answers
    – Topcode
    Dec 28, 2020 at 2:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .