Okay so this idea is pretty damn cool. First step, this portion I've tested and got to work:
code_language.skript:
command /bchest:
trigger:
#Spawns a block that falls like sand. Needs SkQuery
spawn falling beacon 20 meters above and 2 meter horizontally in front of the player
#Waits for the block to fall
wait 2 seconds
#This get's all the blocks around a player and then checks if one of them is a beacon
loop blocks in radius 4 of player:
if loop-block is beacon:
#And then it set's that loop-block beacon to a chest
set loop-block to chest
There's probably several ways to do the custom inventory, but the way I know of would be to on the click event of the chest - cancel the event. Then open a chest gui to the player like this:
code_language.skript:
open chest with 5 rows named "sweet loots" to player
set slot 0 to item named "namehere" with lore "lorehere"
You could create your own list of loot by adding all the possible items to a list variable such as {loots::*} That would look like this:
code_language.skript:
format slot 0 to a random element out of {loots::*}
I'm not 100 % on the deleting the chest after so here's a few ideas I can think of. You could likely do it with the On Inventory Close event(skquery). Possibly needing to set a location variable when the beacon is turned into a chest to be able to loop the blocks around a player again and delete the blocks with a matching location. Loop-block is equal to "%{location.%location%}%".