0

In Minecraft, when you open a world to LAN, and another player joins, they effectively join as "Player 2", then "Player 3", etc.

So, let's say that we have 2 players - Bob and Dave. Bob joins my LAN World, then Dave joins. Let's say that Bob finds 20 Diamonds, and keeps them in his inventory, when the game ends (I stop hosting).

Next time, Dave joins first - he then gets Bob's inventory, meaning that he has control over the 20 diamonds.

Is there any way that I - the world owner can access these "Player 2" inventories in my save file, so that I can organise who has what?

2

Player data doesn't actually work that way — instead of being stored in your world save under “player 2” and “player 3” slots, inventory data is stored in your world save under the UUID of Bob and Dave's Minecraft accounts. This means that Bob will always have Bob's inventory when he connects, and Dave will always have Dave's inventory.

That said, your objective is to get you access to Bob's diamonds. The only way to do this is to edit the files inside the world's save folder, changing Bob and your inventory information by hand. You can do this with an external NBT editor tool, like NBTExplorer, using it to open the players folder and browsing until you find the inventory of the player you're interested in. (After making a backup of your save, of course.)

What you're looking for specifically in the NBT editor is [world name]players[UUID of Dave's account].datInventory. Inside the inventory NBT folder will be a pile of entries, all apparently identical. Each of these represents an inventory slot that has something in it. You have to look through these until you find the one that has inside it count:20 and id:264 (the [ID of the diamond item]3.

Once you find it, what to do with it depends on the capabilities of your NBT editor. If you're using NBTExplorer, you can only view, modify, and delete data – you can't cut and paste it, like NBTEdit can (which is out of date at the moment). The simplest thing to do is to just delete that inventory entry entirely to remove it from Bob's data.

Then, rather than trying to craft a hand-made inventory entry in your own data (which is stored in two different places — level.dat and [UUID of Ben's account].dat — and requires knowing how to set the slot data correctly), instead just start up Minecraft, load the world up, make sure cheats are enabled (either already, or by using the Open to LAN trick to re-enable cheats), and then /give yourself the 20 diamonds.

It's more complicated if you're trying to access complex items like weapons, armour, potions, books, or enchanted items though. In those cases, either use a powerful NBT editor that can cut-and-paste inventory entries… or make sure that Bob stores his stuff in a chest before disconnecting next time!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.