Someone told me they found a way to open chests and take specific items out from them(Which was listed in a file).

Im trying to remake it, I know how to load the chests:

public void findChests(){
		for (TileEntity tileEntity : (List<TileEntity>) mc.theWorld.loadedTileEntityList){ 
			if(tileEntity instanceof TileEntityChest)
   			 TileEntityChest chest = (TileEntityChest)tileEntity;
But how could I take all the diamond out of these chests when they get loaded?