Recently I started Minecraft modding, one of the things I wanted to do was opening chests remotely. For example by using a command. The goal is to get all the items from the chest without actually being at its location.
Currently I have done the following, this gets a chest location from the world and opens a chest gui. While this does open a chest gui, it opens the client chest and not server side, meaning there are no items in it.
RayTraceResult objectMouseOver = player.rayTrace(5, 1);
TileEntityChest te = (TileEntityChest) player.world.getTileEntity(objectMouseOver.getBlockPos());
IInventory inv = null;
if(te instanceof TileEntityChest) {
TileEntityChest teChest = (TileEntityChest) te;
inv = (IInventory) teChest;
}
IInventory finalInv = inv;
Minecraft.getMinecraft().displayGuiScreen(new GuiChest(player.inventory, finalInv));
My question is, can I get the server side chest data or GUI within the code? And how to do this?