/gamemode keepInventory true
Chat with our AI personalities
First, you must turn cheats on in your world. Then, you do the command /gamerule keepinventory true.
to keep inventory you can do /gamerule keepinventory true or /gamerule keepinventory false
The Default Command for opening your inventory is E (previously I).To close the inventory menu, press E (or I) or Esc.
you have to do /gamerule keepinventory true or /gamerule keepinventory false
Pressing 'E' will open your inventory.